You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Align sqlite3.Connection.iterdump with the .dump() command of the SQLite shell #108364
Return an iterator to dump the database as SQL source code.
The current implementation has several drawbacks compared to the SQLite shell .dump command. We should try to align our implementation with the .dump command of the SQLite shell.
The SQLite shell always starts the dump by disabling foreign key support. It has been doing so for a long time:
$ ~/install/sqlite-3.42.0/bin/sqlite3SQLite version 3.42.0 2023-05-16 12:36:15Enter ".help" for usage hints.Connected to a transient in-memory database.Use ".open FILENAME" to reopen on a persistent database.sqlite> .dumpPRAGMA foreign_keys=OFF;BEGIN TRANSACTION;COMMIT;sqlite> ^D
$ ~/install/sqlite-3.7.15/bin/sqlite3SQLite version 3.7.15 2012-12-12 13:36:53Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> .dumpPRAGMA foreign_keys=OFF;BEGIN TRANSACTION;COMMIT;sqlite> ^D
I suggest we align to this practise.
In SQLite foreign key support is always disabled by default; one has to explicitly enable it, if needed.
I'm closing this issue, since it has no more actionable items; instead, we can open better targeted issues for specific .dump features we would like to add to .iterdump().
Activity
erlend-aasland commentedon Aug 25, 2023
The SQLite shell always starts the dump by disabling foreign key support. It has been doing so for a long time:
I suggest we align to this practise.
In SQLite foreign key support is always disabled by default; one has to explicitly enable it, if needed.
pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …
erlend-aasland commentedon Aug 25, 2023
I restyled this as a feature, not a bugfix.
pythongh-108364: Simplify quoting values/identifiers in sqlite3.dump.…
gh-108364: Simplify quoting values and identifiers in sqlite3's iterd…
erlend-aasland commentedon Aug 29, 2023
cc. @EddInSverige
erlend-aasland commentedon Aug 30, 2023
FTR, here's the SQLite shell C code:
https://sqlite.org/src/file?name=src/shell.c.in&ci=trunk
pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …
pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …
gh-108364: In sqlite3, disable foreign keys before dumping SQL schema (…
erlend-aasland commentedon Jan 12, 2024
I'm closing this issue, since it has no more actionable items; instead, we can open better targeted issues for specific
.dumpfeatures we would like to add to.iterdump().pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …
pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …
pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …