从 Python/SQLAlchemy 使用 SQLite 的备份 API [英] Use SQLite's backup API from Python/SQLAlchemy
问题描述
我正在使用来自 python 的 SQLite 数据库(带有 SQLAlchemy).出于性能原因,我想在应用程序中填充内存数据库,然后将该数据库备份到磁盘.
I'm using an SQLite database from python (with SQLAlchemy). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk.
SQLite 有一个 backup API,它似乎可以透明地做到这一点.
SQLite has a backup API, which seems would do this transparently.
APSW 文档说它包装了备份 API,但我想从 Python 的标准 sqlite3 模块或在最好的情况下从 SQLAlchemy 访问此功能.这可能吗?
The APSW documentation says that it wraps the backup API, but I'd like to access this functionality from Python's standard sqlite3 module, or in the best case from SQLAlchemy. Is this possible?
推荐答案
python-sqlite3-backup 模块声称可以解决这个问题.
The python-sqlite3-backup module claims to solve this problem.
这篇关于从 Python/SQLAlchemy 使用 SQLite 的备份 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!