I am using a SQLite database from python ( SQLAlchemy ). For performance reasons, I would like to populate the database in memory in the application, and then back up this database to disk.
SQLite has a backup API that seems to make it transparent.
The APSW documentation says that it is completing the backup of the API , but I would like to access this function from the standard Python sqlite3 module, or at best from SQLAlchemy. Is it possible?
The python-sqlite3-backup module claims to solve this problem.
APSW dialect can also be easily added to SQLAlchemy. This would be very easy to achieve at 0.6, which allows several kinds of DBAPI adapters to use a common dialect for the database used.
If pysqlite and apsw are linked to the same sqlite library, then pysqlite can accept apsw connections. Cm:
http://docs.pysqlite.googlecode.com/hg/sqlite3.html#combining-apsw-and-pysqlite
I will try to work on this (and other) approach to getting apsw to work with SQLAlchemy, since they are a very useful combination.
When i do the following
import sqlite3 dir(sqlite3)
I do not see any backup API method.
Therefore, the answer is no; you cannot access the API from sqlite3 module. Nobody seems to have implemented it.