sqlite3.Connection.iterdump() produces an unrestorable dump for a populated virtual table
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug description
sqlite3.Connection.iterdump() emits INSERT statements for a virtual table's
own rows in addition to its schema. Those rows live in the shadow tables (which
are dumped separately), and on restore they run before the virtual table module
is instantiated, so restoring the dump fails:
import sqlite3
src = sqlite3.connect(":memory:")
src.execute("CREATE VIRTUAL TABLE t USING fts4(x)")
src.execute("INSERT INTO t(x) VALUES ('hello world')")
script = "".join(src.iterdump())
dst = sqlite3.connect(":memory:")
dst.executescript(script)
# sqlite3.OperationalError: no such table: t
The SQLite shell's .dump does not emit content rows for virtual tables.
CPython versions tested on
3.14, 3.15, 3.16
Operating systems tested on
macOS
Linked PRs
- gh-153730
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example through sqlite3.Connection.iterdump() and compare its output with SQLite's .dump behavior. Done means a dump from a populated virtual table can be executed on a new connection without the reported no such table failure; check linked PR gh-153730 before starting because work is already associated with the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100