APSW-SQLite3MultiCiphers
raw JSON → 3.53.0.0 verified Fri May 01 auth: no python
APSW-SQLite3MultiCiphers is a Python wrapper around SQLite3 Multiple Ciphers (SQLCipher alternative) using APSW. It provides advanced encryption features for SQLite databases with multiple cipher algorithms. Current version 3.53.0.0, based on APSW 3.53.0.0 and SQLite3MultipleCiphers 2.3.3. Release cadence follows SQLite releases.
pip install apsw-sqlite3mc Common errors
error apsw.ExecutionCompleteError: cannot operate on a closed database ↓
cause Trying to execute SQL on a connection that has been closed.
fix
Reopen the connection or avoid closing it prematurely.
error apsw.ExecutionCompleteError: unable to open database file ↓
cause File path not found or permission denied.
fix
Check that the directory exists and is writable. Use absolute paths if needed.
error apsw.ExecutionCompleteError: file is not a database ↓
cause Opening a file that is not a valid SQLite database or the key is incorrect.
fix
Verify the file is a SQLite database. If encrypted, provide the correct key via PRAGMA after opening.
error ImportError: cannot import name 'some_function' from 'apsw' ↓
cause Trying to import a function that does not exist in APSW.
fix
Check the APSW documentation for correct function names.
Warnings
gotcha The APSW API is not the same as the stdlib sqlite3 module. Use 'apsw.Connection' and 'apsw.Cursor' directly. ↓
fix Use 'apsw.Connection' instead of 'sqlite3.connect()'.
gotcha Encryption PRAGMA must be set immediately after opening the connection before any other operations. ↓
fix Issue 'PRAGMA key=...' as the first operation after creating the connection.
gotcha Some cipher settings (like cipher_page_size) must be set before the key PRAGMA. ↓
fix Set cipher parameters before setting the key, e.g., PRAGMA cipher_page_size=4096; PRAGMA key='...'.
breaking Versioning scheme changed from 3.x.y.z to 3.x.y.z (APSW based). Ensure you are using compatible encryption parameters if upgrading from older versions. ↓
fix Check the SQLite3MultipleCiphers changelog for encryption defaults changes.
Imports
- apsw wrong
from apsw_sqlite3mc import some_modulecorrectimport apsw - Connection wrong
con = apsw.connect('test.db')correctcon = apsw.Connection('test.db')
Quickstart
import apsw
con = apsw.Connection('encrypted.db')
con.execute("PRAGMA key='your-encryption-key'")
cursor = con.cursor()
cursor.execute('CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY)')
print('Table created successfully')
con.close()