Importing a SQLite3 dump back into the database
cat dumpfile.sql | sqlite3 my_database.sqlite
This should also work:
echo '.read export.sqlite3.sql' | sqlite3 my_database.sqlite3
One possible advantage over "sqlite3 my_database.sqlite3 < export.sqlite3.sql
" is that SQLite's .read
command might (now or in the future) be more advanced than just "read in all the text and execute it." It might do batching, which would reduce memory usage for large dumps. I admit, though, that this is a pretty obscure and unlikely advantage. In all likelihood, .read
simply reads each line from the input and executes it, just like the redirection and pipe operators.