Iczer Posted January 3, 2019 Share Posted January 3, 2019 I need to make partial backup of sqlite db, but to do it db/table schema is needed. To create universal function, I cannot reuse db creation query. So how I can get it from main db? $sQuery = "CREATE TABLE IF NOT EXISTS SRDB " & $sSqlBuild_Table & ";" Or maybe there a another method to do partial backup? Link to comment Share on other sites More sharing options...
dmob Posted January 3, 2019 Share Posted January 3, 2019 This may/may not be what you want Link to comment Share on other sites More sharing options...
jchd Posted January 3, 2019 Share Posted January 3, 2019 select * from sqlite_master returns all the DDL statements you need. You may need to first extract the rows having type = 'table', then 'index' then 'trigger' then 'view', then ... After that you may have to reorder CREATE TABLE statements so that foreign keys work in the correct order. Iczer 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Skysnake Posted January 3, 2019 Share Posted January 3, 2019 Why would you want to make a partial backup? And of WHAT exactly would this be a partial backup? Of all the data in certain tables, or of only data inserted during the current session? Alternatively to the backup, make a full copy and delete what you don't need? ... ? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
jchd Posted January 3, 2019 Share Posted January 3, 2019 Making first a backup of a 7.8Tb DB then dropping 7.725Tb of unneeded data in the copy, then performing a vacuum is pretty inefficient. It's possible to get and filter DDL statements from the source DB as shown above and create only the tables/indices/triggers/views needed in the copy, then copy corresponding rows. In this case, one can use regular open of source and ATTACH the target, name it tgt for instance. Then insert into tgt.table_A select * from table_A; will do. Repeat and rince for all wanted tables. Otherwise several third-party SQLite DB managers allow copying tables from one DB to another one. I personnally use SQLite Expert Pro (payware) whenever I need to perform such task. All required accompanying DDL statements (tables, indices and triggers) are automagically managed. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Skysnake Posted January 3, 2019 Share Posted January 3, 2019 Hmm, thanks @jchd. Point taken. Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Iczer Posted January 4, 2019 Author Share Posted January 4, 2019 16 hours ago, jchd said: select * from sqlite_master Thanks! It exactly what i need! Link to comment Share on other sites More sharing options...
cristiscu Posted January 8, 2020 Share Posted January 8, 2020 (edited) <snip> We do not permit ads for paid solutions - even if they are of your own making. Please do not do it again. M23 Edited January 8, 2020 by Melba23 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now