sqlite3.Connection.iterdump() produces an unrestorable dump for a populated virtual table
未關閉
還沒有人認領這個 Issue。
stdlib
topic-sqlite3
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先透過 sqlite3.Connection.iterdump() 重現該範例,並將其輸出與 SQLite 的 .dump 行為進行比較。完成的標準是:來自已填入資料的虛擬表的 dump 可以在新連線上執行,而不會出現回報的 no such table 錯誤;開始前請檢查已連結的 PR gh-153730,因為這項工作已經與該 issue 關聯。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python, sqlite
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100