How to dump the data of some SQLite3 tables?

You’re not saying what you wish to do with the dumped file.

To get a CSV file (which can be imported into almost everything)

.mode csv 
-- use '.separator SOME_STRING' for something other than a comma.
.headers on 
.out file.csv 
select * from MyTable;

To get an SQL file (which can be reinserted into a different SQLite database)

.mode insert <target_table_name>
.out file.sql 
select * from MyTable;

Leave a Comment

tech