Python bindings for SQLRite — a small, embeddable SQLite clone written in Rust.
Project description
sqlrite (Python)
Python bindings for SQLRite — a small, embeddable SQLite clone written in Rust. Shape follows PEP 249 / the stdlib sqlite3 module, so most callers can pick it up without reading the docs.
Install
# From PyPI (once Phase 6e's CI/CD release pipeline is live):
pip install sqlrite
# From source in a clone of the repo:
pip install maturin
cd sdk/python
maturin develop --release
Quick tour
import sqlrite
# File-backed or in-memory (use `":memory:"` to match sqlite3 convention).
conn = sqlrite.connect("foo.sqlrite")
# conn = sqlrite.connect(":memory:")
cur = conn.cursor()
cur.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")
cur.execute("INSERT INTO users (name, age) VALUES ('alice', 30)")
cur.execute("INSERT INTO users (name, age) VALUES ('bob', 25)")
cur.execute("SELECT id, name, age FROM users")
for row in cur:
print(row) # (1, 'alice', 30), then (2, 'bob', 25)
# Column metadata (PEP 249 `.description`):
for col in cur.description:
print(col[0]) # 'id', 'name', 'age'
conn.close()
Transactions
with sqlrite.connect("foo.sqlrite") as conn:
cur = conn.cursor()
cur.execute("BEGIN")
cur.execute("INSERT INTO users (name) VALUES ('carol')")
if looks_good:
conn.commit()
else:
conn.rollback()
# The context manager automatically commits on clean exit
# and rolls back on exception, then closes the connection.
Read-only access
conn = sqlrite.connect_read_only("foo.sqlrite")
# Any write raises sqlrite.SQLRiteError. Multiple read-only
# connections on the same file coexist (shared OS lock).
API surface
| Function / Method | Purpose |
|---|---|
sqlrite.connect(db) |
Open or create a file-backed DB (or :memory:) |
sqlrite.connect_read_only(db) |
Open an existing file with a shared lock |
Connection.cursor() |
Returns a new Cursor |
Connection.execute(sql, ...) |
Shortcut for cursor().execute(...) |
Connection.commit() / .rollback() |
Close the current transaction |
Connection.close() |
Drop the connection (releases OS file lock) |
Connection.in_transaction |
bool — inside a BEGIN … COMMIT/ROLLBACK |
Connection.read_only |
bool — opened via connect_read_only |
Cursor.execute(sql, params=None) |
Run one statement |
Cursor.executemany(sql, seq) |
DB-API placeholder (params deferred) |
Cursor.executescript(sql) |
;-separated batch of statements |
Cursor.fetchone() |
Next row as a tuple, or None |
Cursor.fetchmany(size=None) |
Up to size more rows as a list of tuples |
Cursor.fetchall() |
All remaining rows |
Cursor.description |
PEP 249 7-tuples per column (name + Nones) |
Cursor.rowcount |
-1 (not tracked yet — returns as PEP 249 says) |
iter(cursor) |
for row in cursor: … |
sqlrite.SQLRiteError |
All engine failures bubble up as this |
Parameter binding
execute(sql, params) accepts None and empty tuples/lists for DB-API compatibility, but any non-empty params raises TypeError with a clear message — the underlying engine doesn't support prepared-statement parameter binding yet (deferred to Phase 5a.2). For now, inline values into the SQL (with manual escaping).
Running the tests
maturin develop
python -m pytest tests/
How this ships
- PyO3 (
abi3-py38) for the Rust-Python boundary — one wheel works on every CPython 3.8+ release, no per-version rebuild. - maturin as the build backend, emitting standard
.whlfiles that pip can install directly. - Phase 6e lands GitHub Actions that publish wheels to PyPI for manylinux x86_64/aarch64, macOS universal, and Windows x86_64 on every
v*tag push.
Status
Phase 5c MVP: ✅ — basic CRUD, transactions, context managers, read-only mode, iteration. Parameter binding, CursorRow namedtuples, and type converters (datetime, Decimal) are natural follow-ups.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlrite-0.1.8.tar.gz.
File metadata
- Download URL: sqlrite-0.1.8.tar.gz
- Upload date:
- Size: 772.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6fe7025277490f2722739bc430b60fab1e3f16646f18cdcbde7969d3acfec09
|
|
| MD5 |
857824713e28b34640b335c2d0727549
|
|
| BLAKE2b-256 |
d86023ce8e87268be7911452019e16a6b758d487724de472ff2b262748bdb6c9
|
Provenance
The following attestation bundles were made for sqlrite-0.1.8.tar.gz:
Publisher:
release.yml on joaoh82/rust_sqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlrite-0.1.8.tar.gz -
Subject digest:
b6fe7025277490f2722739bc430b60fab1e3f16646f18cdcbde7969d3acfec09 - Sigstore transparency entry: 1383317692
- Sigstore integration time:
-
Permalink:
joaoh82/rust_sqlite@37eab3435271dc2916e219db842a83776d868e3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/joaoh82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@37eab3435271dc2916e219db842a83776d868e3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlrite-0.1.8-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: sqlrite-0.1.8-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9c7c3f2f4dd526f905aa97fdd74dd78800cf3a7c890aa00c1d14ac3dc705855
|
|
| MD5 |
e45f6bc4a6a244a6adeee6829142a266
|
|
| BLAKE2b-256 |
e63a9e433046b857988eb7d7f4611787fa237d21f6ceb15619e70b3156b780cb
|
Provenance
The following attestation bundles were made for sqlrite-0.1.8-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on joaoh82/rust_sqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlrite-0.1.8-cp38-abi3-win_amd64.whl -
Subject digest:
b9c7c3f2f4dd526f905aa97fdd74dd78800cf3a7c890aa00c1d14ac3dc705855 - Sigstore transparency entry: 1383317777
- Sigstore integration time:
-
Permalink:
joaoh82/rust_sqlite@37eab3435271dc2916e219db842a83776d868e3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/joaoh82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@37eab3435271dc2916e219db842a83776d868e3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlrite-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: sqlrite-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2868d563f3b774dc7b7ddfe8dedb5fe828e440ac1f526804617ffb3edee0d82d
|
|
| MD5 |
597ae2e4d08b123f1eb0b497f22635a4
|
|
| BLAKE2b-256 |
6a898c8629e337b8e4a1e4fcb8239d81d5b36f39632bd4662cb96820d95151ba
|
Provenance
The following attestation bundles were made for sqlrite-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on joaoh82/rust_sqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlrite-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
2868d563f3b774dc7b7ddfe8dedb5fe828e440ac1f526804617ffb3edee0d82d - Sigstore transparency entry: 1383317710
- Sigstore integration time:
-
Permalink:
joaoh82/rust_sqlite@37eab3435271dc2916e219db842a83776d868e3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/joaoh82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@37eab3435271dc2916e219db842a83776d868e3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlrite-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: sqlrite-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25976cfbe6b567ebdd66831ca40a4c0b3c01d3bebad8eca4692ad70d16d7fd14
|
|
| MD5 |
187fedc6fa7d6e7dccd0eb849f9c1d0c
|
|
| BLAKE2b-256 |
fdb51e53e3282a90a83ae7153dc93654129a3ba7486b0b55df5319aa7022d717
|
Provenance
The following attestation bundles were made for sqlrite-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on joaoh82/rust_sqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlrite-0.1.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
25976cfbe6b567ebdd66831ca40a4c0b3c01d3bebad8eca4692ad70d16d7fd14 - Sigstore transparency entry: 1383317736
- Sigstore integration time:
-
Permalink:
joaoh82/rust_sqlite@37eab3435271dc2916e219db842a83776d868e3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/joaoh82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@37eab3435271dc2916e219db842a83776d868e3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlrite-0.1.8-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: sqlrite-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfafb60e1b7088e19e45bb988ef630c893f1f7fd8e805f26d5831fcce334243a
|
|
| MD5 |
09e8757b532ab98ea45bfc9ed3fd204e
|
|
| BLAKE2b-256 |
3080707ededffcbfe0f913de99450f1568a87258f6418769534baa07ab6678f2
|
Provenance
The following attestation bundles were made for sqlrite-0.1.8-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on joaoh82/rust_sqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlrite-0.1.8-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
bfafb60e1b7088e19e45bb988ef630c893f1f7fd8e805f26d5831fcce334243a - Sigstore transparency entry: 1383317755
- Sigstore integration time:
-
Permalink:
joaoh82/rust_sqlite@37eab3435271dc2916e219db842a83776d868e3a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/joaoh82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@37eab3435271dc2916e219db842a83776d868e3a -
Trigger Event:
push
-
Statement type: