" Availability: SQLite 3.6.11 or higher. New in version 3.7.
import sqlite3
source = sqlite3.connect('existing_db.db')
dest = sqlite3.connect(':memory:')
source.backup(dest)
$ poetry run python
Python 3.9.13 (main, Aug 28 2022, 15:38:55)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.37.0'
書き込みやら何やらで以下の流れをずっとやってるため遅い。
データを一時的にインメモリデータベースに格納し、そこでごちゃごちゃやった後に、ファイルへ出力すれば多分速くなる
https://stackoverflow.com/questions/3850022/how-can-i-load-an-existing-database-file-into-memory-in-python-sqlite-3