I have a relational SQLite database with tables accessing each other via foreign keys. When I use SqlLiteStudio "Export" to output to a new SQL file, it writes out SQL "CREATE" and "INSERT INTO" statements based on alphabetical order of table names. When I then import the same SQL file into a new database (which requires use of the command "Execute SQL from File", because the import command seems to only import csv into a table), I get the "no such table" error, because the line to create the table being referenced is not yet read. So if I edit the SQL file to put the tables at the top, then I get the "FOREIGN KEY constraint failed" error. So then if I edit the SQL file to all the tables insert operations below the table creations, AND reorder the inserts by table so that no table precedes its table dependencies, only then I can successfully import the SQL file, reproducing the original SQLite database file. Seems like a bug in SqlLiteStudio. I suppose worse case I can write a post-processing script, but I'm hoping to find out if there's some better method people are using. I just prefer to save in text format for backup into an existing git repo, and also make it easier for db migration later. TIA.
How can I get SqlLiteStudio to export to SQL file with tables in the correct order?
366 Views Asked by Mark Seagoe At
1
There are 1 best solutions below
Related Questions in SQLITE
- How to store a date/time in sqlite (or something similar to a date)
- How to copy data from SQLite to postgreSQL?
- When using a Room database on an Android application, is it possible to pre-populate data
- Expo Error - Android sqlite no such table
- how can debugg field id error in the database schema?
- How add array of authors for unique user in database in Goland IDE?
- Calculate SMA_Close10 and SMA_Close20 of minute data
- Transitioning from Static to Dynamic Data in React with Express Backend
- In SQLite, how to group ranges of values and sort the groups
- Issue with making python executable with local db, sqlite3, tkinter
- Calculating EuclideanDistance in SQL for Deepface facial embeddings?
- Problem with a simple query script used in RS Forms on Joomla 4
- Checking multiple user inputs to multiple fields in a sqlite3 database with python
- How to make that each seller has its own different set of products using sqlite and uwp
- peewee: SQLite - peewee Create() is forcing integer in PrimaryKeyField if leading character is numeric (even if there is a non-numeric in the middle)
Related Questions in EXPORT
- How can I export a function within a React functional component to build a library?
- Gradio chatbot: how to export individual conversation histories?
- Conditional Synchronous Import in JavaScript, to export a simple object and not promise, possible?
- SSRS report exporting as PPT file
- How to display a link to an empty blob on an HTML page (vanilla JS)
- Netsuite Saved Search does not export all results
- Exporting ed25519 private key in OpenSSH Format JavaScript
- Bokeh JS download plot image
- How I can export to make diferents pages for one web site and put the pictures? ps: i'm new in dev
- How to export tab-delimited text file from Python (with spesifications)
- TailRec optimisation and export
- Split records into txt files having the same number of records
- Is there a way to automatically export OpenOffice/LibreOffice drawings to bitmaps, with options?
- Webhook call from github action
- SyntaxError on importing named export in Node.js app when deploying to Render.com
Related Questions in SQLITESTUDIO
- How do I combine rows into group sets?
- Trouble exporting (and then importing) .db files correctly in SQLiteStudio
- Cannot install SQLite Studio on Raspberry Pi 3B
- SQLite view column name, specifically in SQLiteStudio
- Why can't I divide two column number values in SQLite Studio?
- How to print function parameter's value?
- SQL GROUP BY vs AVG (Problem 25 of SQL Practice Problems Book)
- Window frame specification in SQLiteStudio
- Update a new column based on existing an column's value
- How to view a temporary table?
- How can i import .DMP files into SQLiteStudio
- BEFORE INSERT trigger with primary key using the sqlite3 shell .import command
- Unable to understand sql statement termination
- SQLiteStudio: Is there a way to match row values from one table to column headers in another?
- How can I create a Running Total Sumifs-like function in SQL?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You could turn Foreign Key Support Off before the import and then back On after the import using
see https://sqlite.org/pragma.html#pragma_foreign_keys