Registry / database / sqlcipher3

sqlcipher3

JSON →
library0.6.2pypypi✓ verified 34d ago

sqlcipher3 provides a DB-API 2.0 compatible interface for SQLCipher 4.x, allowing encrypted SQLite databases. It wraps SQLCipher's C library and supports transparent 256-bit AES encryption of database files. Current version 0.6.2, requires Python >=3.9. Pre-built wheels available for many platforms; on some systems you may need to compile from source.

databaseauth-security
Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
1/2 runs
✓ 1.7s
py 3.11
1/2 runs
✓ 1.95s
py 3.12
1/2 runs
✓ 1.7s
py 3.13
1/2 runs
✓ 1.7s
py 3.9
1/2 runs
✓ 3.2s
36MB installed
● package 36MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Old pattern for pysqlcipher3, not compatible with sqlcipher3

from sqlcipher3 import connect

Incorrect: sqlcipher3 itself is not a module with connect; use dbapi2 submodule

from sqlcipher3 import dbapi2

Create an in-memory encrypted database. PRAGMA key must be set before any other operations.

import os from sqlcipher3 import dbapi2 as sqlite conn = sqlite.connect(':memory:') conn.execute("PRAGMA key='secret'") conn.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)') conn.execute('INSERT INTO test VALUES (1, "hello")') print(conn.execute('SELECT * FROM test').fetchone()) conn.close()
Debug
Known footguns
breakingsqlcipher3 is NOT compatible with sqlcipher (version 2.x) or pysqlcipher3. It only works with SQLCipher 4.x. If you have SQLCipher 3.x, you need a different library (e.g., `pysqlcipher3`).
gotchaOpening a database without setting the key will fail with 'DatabaseError: file is not a database' if the file exists and is encrypted, or create an unencrypted database if new. Always set PRAGMA key immediately after connect.
gotchaPRAGMA key and PRAGMA cipher_* settings must be executed on the same connection before any other queries. Changing these after data has been written can corrupt the database.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
claudebot
2
script
1
mj12bot
1
bytedance
1
Resources