![](/img/trans.png)
[英]How can I create a SQLite table using the sqlite3 Python library with parameterized placeholders?
[英]How can I convert SQLite 2 to SQLite3 using Python on Windows?
我正在嘗試在Windows上使用Python將SQLite 2文件轉換為SQLite3。 在Linux上,我只是將sqlite
的轉儲傳遞給sqlite3
:
os.system("sqlite db.sqlite .dump | sqlite3 db3.sqlite")
在Windows上,我沒有轉移轉儲的便捷方法。 這是我在做什么:
sqlite_dump = os.popen('sqlite %s .dump' % sqlite_db).read()
open(sqlite_dump_file, "w").write(sqlite_dump)
os.system("del %s" % sqlite_db)
os.system("sqlite3 -init %s %s" % (sqlite_db,
sqlite_dump_file))
這有效,但是在sqlite3
提示符下出現了。 我已經嘗試了-bail
開關,並在SQLite轉儲的末尾添加了“ \\ n.quit \\ n”,但無濟於事。
我能做什么?
為什么不能在Windows上以類似方式傳送它? 做錯了什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.