How do I dump the data of some SQLite3 tables?
You're not saying what you wish to do with the dumped file.
I would use the following to get a CSV file, which I can import into almost everything
.mode csv -- use '.separator SOME_STRING' for something other than a comma..headers on .out file.csv select * from MyTable;
If you want to reinsert into a different SQLite database then:
.mode insert <target_table_name>.out file.sql select * from MyTable;
You can do this getting difference of .schema and .dump commands. for example with grep:
sqlite3 some.db .schema > schema.sqlsqlite3 some.db .dump > dump.sqlgrep -vx -f schema.sql dump.sql > data.sql
data.sql
file will contain only data without schema, something like this:
BEGIN TRANSACTION;INSERT INTO "table1" VALUES ...;...INSERT INTO "table2" VALUES ...;...COMMIT;
I hope this helps you.