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
Pitch
Copying tables is much easier when a dump per table is available.
Previous discussion https://stackoverflow.com/a/6677833/1497139 already suggested a code change in stackoverflow in 2011. I think it just never made it as a feature request here.
@rawwar have you seen sqlite3 issues? There is one "TODO Bug" without a PR, and a fair few uncategorised issues. @erlend-aasland is the point man for sqlite though -- I just review or triage!
sqlite> .help .dump.dump ?OBJECTS? Render database content as SQL Options: --data-only Output only INSERT statements --newlines Allow unescaped newline characters in output --nosys Omit system tables (ex: "sqlite_stat1") --preserve-rowids Include ROWID values in the output OBJECTS is a LIKE pattern for tables, indexes, triggers or views to dump Additional LIKE patterns can be given in subsequent argumentssqlite> CREATE TABLE t(t); sqlite> CREATE TABLE r(r);sqlite> .dump rPRAGMA foreign_keys=OFF;BEGIN TRANSACTION;CREATE TABLE r(r);COMMIT;
PR #114501 implements this feature similar to how the SQLite CLI .dump command works. We do have time to adjust this feature before the feature freeze in May, but still I'd like to give a little thought to the API we're now introducing, before landing the PR.
The SQLite CLI .dump command is implemented in shell.c.in1 (a template C file in the SQLite repo). Here are some excerpts from the code:
As you can see from the links, there are some differences in that multiple filters are allowed in the SQLite CLI, and the SQL query itself is slightly different. Perhaps that does not matter :)
Should we expand the feature to allow multiple LIKE patterns? Should we use a similar SQL query as the SQLite CLI? I suggest we try out the feature now in the early alphas, and then we can amend or enhance this functionality in due time before May.
Footnotes
If you're using the amalgamated sources, you'll see it simply as shell.c. ↩
We're long past the 3.13 beta feature freeze and 3.13 was released in October, so I think we can close this now. Please re-open if still needed. Thanks all!
Reacted by Mariusz Felisiak, Erlend E. Aasland, Wolfgang Fahl and Khemarato Bhikkhu
Activity
akulakov commentedon Apr 24, 2022
Note there are alternative ways to dump table data provided here: https://stackoverflow.com/questions/75675/how-do-i-dump-the-data-of-some-sqlite3-tables
kalyanr23 commentedon Jun 9, 2022
If no one is already working on this, I would like to pick this up
erlend-aasland commentedon Jun 9, 2022
Let's find out if we should add it or not first 😉 I'm not totally convinced it is really needed.
rawwar commentedon Jun 9, 2022
AA-Turner commentedon Jun 9, 2022
@rawwar have you seen sqlite3 issues? There is one "TODO Bug" without a PR, and a fair few uncategorised issues. @erlend-aasland is the point man for sqlite though -- I just review or triage!
A
rawwar commentedon Jun 9, 2022
erlend-aasland commentedon Jan 15, 2024
FTR, the SQLite CLI accepts an "OBJECTS" param:
6 remaining items
felixxm commentedon Jan 23, 2024
@erlend-aasland Can you help me a bit 🙏 ? I made the following changes to the
_sqlite/clinic/connection.c.hwhich are probably OKbut, I'm puzzled how to reflect them in
Modules/_sqlite/connection.c. I've tried to usePyObject_Call()instead ofPyObject_CallOneArg:but no luck 😞 :
erlend-aasland commentedon Jan 23, 2024
@felixxm, can you create a draft PR? It's easier to make suggestions and comment on a PR :)
pythongh-91602: Add iterdump() support for filtering database objects.
felixxm commentedon Jan 23, 2024
Done, #114501.
pythongh-91602: Add iterdump() support for filtering database objects.
pythongh-91602: Add iterdump() support for filtering database objects.
erlend-aasland commentedon Jan 26, 2024
PR #114501 implements this feature similar to how the SQLite CLI
.dumpcommand works. We do have time to adjust this feature before the feature freeze in May, but still I'd like to give a little thought to the API we're now introducing, before landing the PR.The SQLite CLI
.dumpcommand is implemented inshell.c.in1 (a template C file in the SQLite repo). Here are some excerpts from the code:As you can see from the links, there are some differences in that multiple filters are allowed in the SQLite CLI, and the SQL query itself is slightly different. Perhaps that does not matter :)
Should we expand the feature to allow multiple LIKE patterns? Should we use a similar SQL query as the SQLite CLI? I suggest we try out the feature now in the early alphas, and then we can amend or enhance this functionality in due time before May.
Footnotes
If you're using the amalgamated sources, you'll see it simply as
shell.c. ↩gh-91602: Add iterdump() support for filtering database objects (#114501
erlend-aasland commentedon Feb 6, 2024
I merged #114501. There is time to tweak the API before the feature freeze, if needed.
pythongh-91602: Add iterdump() support for filtering database objects (…
felixxm commentedon Feb 21, 2024
I think we can move this in the
sqlite3project board to theDoneor at leastIn Progresscard.hugovk commentedon Jan 7, 2025
We're long past the 3.13 beta feature freeze and 3.13 was released in October, so I think we can close this now. Please re-open if still needed. Thanks all!