DB Browser Full SQL Dump


Are you working with a SQLite database file that you want to re-organize? What do I mean by that? Perhaps you have built your database with sql files that contain many CREATE TABLE, ALTER TABLE, CREATE VIEW and INSERT INTO statements. That’s great and that’s how I like to do it. It can get a bit messy. Why not refactor that from one CREATE TABLE statement and three ALTER TABLE statements to just one CREATE TABLE statement. Refactor six INSERT INTO statements to one.

For example, as you work with your database you will likely want to add more data to it and even add more tables and views. The challenge is to keep that initial SQL file up to date with you latest additions. How can you do that? You can dump the database to an SQL file quite easily with DB Browser. Go to File,

Do a SQl dump. Once you have that SQL code, you can simply create a new database file with DB Browser and run the sql file to create all of the tables, views and load all of our data. It’s very fast and easy.

In DB Broswer with your database open, go to File > Export > Databse to SQL File… Select the tables you want to Select All if desired. Choose Export schema only. We’ll do this in two steps. You can create a new database file and run it in the new file. Write changes.

The trickier part is the data. Order matters. Linking table must come after the main tables. DB Browser does it in alphabetical order.

Leave a Reply