Python (DB-API 2.0) binding for SQLXtraLite — a from-scratch SQL engine in Rust
Project description
SQLXtraLite — Python binding (PyO3, DB-API 2.0)
A native CPython extension built with PyO3 that calls the Rust
engine directly (no C-ABI round-trip) and exposes a small DB-API 2.0 surface.
Values come back as native Python types (int, float, str, bytes,
None).
There's also a zero-dependency
ctypesbinding in../python/— no build tools, but it returns string values. This PyO3 binding is the idiomatic, pip-installable one. The engine crate itself stays dependency-free; PyO3 lives only here.
Build & install
# from this directory (bindings/pyo3)
pip install maturin
maturin develop --release # build + install into the current venv
# or build a redistributable wheel:
maturin build --release # -> target/wheels/sqlxtralite-*.whl
pip install target/wheels/sqlxtralite-*.whl
A plain cargo build --release also links a loadable module here (via
.cargo/config.toml); rename target/release/libsqlxtralite.dylib → sqlxtralite.so
(.so on Linux) on your PYTHONPATH to import it without maturin.
Use
import sqlxtralite
con = sqlxtralite.connect("shop.db")
cur = con.cursor()
cur.execute("CREATE TABLE items (id INTEGER PRIMARY KEY, name TEXT, price REAL)")
cur.executemany("INSERT INTO items VALUES (?, ?, ?)",
[(1, "basil", 2.95), (2, "mint", None)])
cur.execute("SELECT * FROM items WHERE price > ?", (1.0,))
print(cur.description) # [('id', None, …), ('name', …), ('price', …)]
print(cur.fetchall()) # [(1, 'basil', 2.95)] ← native int / str / float
print(cur.lastrowid, cur.rowcount)
con.close()
API (DB-API 2.0 subset)
Module: connect(path), apilevel = "2.0", threadsafety = 1,
paramstyle = "qmark", Error.
| Object | Methods / attrs |
|---|---|
Connection |
cursor(), execute(sql, params=None), commit(), rollback(), close(), context manager |
Cursor |
execute(sql, params=None), executemany(sql, seq), fetchone(), fetchmany(size=1), fetchall(), description, rowcount, lastrowid, close() |
Parameters use qmark style (?), positional; None→NULL, int/float/str/
bytes bind directly. Prepared statements are used automatically when you pass
params (and for executemany), giving the engine's fast bind path.
Run the test
maturin develop --release
python3 test_dbapi.py
# OK — PyO3 DB-API binding works
Notes
Connection/Cursorareunsendable— use one connection per thread (the engine is single-writer; the GIL serializes calls anyway).- SQLXtraLite auto-commits each statement, so
commit()/rollback()are no-ops provided for DB-API shape; use explicitBEGIN/COMMITSQL for multi-statement transactions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 sqlxtralite-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: sqlxtralite-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 748.6 kB
- 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 |
7e621acd9c129bd403c5f97ff256145092db243cd9e86c5f620122b838c5bcbe
|
|
| MD5 |
89278fd3deaa07839d4568c5b42d50ac
|
|
| BLAKE2b-256 |
4769e3c163b7eda078396592c939df8e2b1d028834a62b7f90b7382ce57db7a7
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
wheels.yml on parisxmas/SQLXtraLite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlxtralite-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
7e621acd9c129bd403c5f97ff256145092db243cd9e86c5f620122b838c5bcbe - Sigstore transparency entry: 1748111005
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 912.1 kB
- 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 |
279d16459b7fbd33a39e2b094e56e09649ca3326de232c9218f91531e49f5aaa
|
|
| MD5 |
61114d71c2768a5ed616d250e4708093
|
|
| BLAKE2b-256 |
67539d3a66c21ac5d24eda4e0fc82314d6b851a9c6fb9ce303d51c6844fcf713
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
wheels.yml on parisxmas/SQLXtraLite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
279d16459b7fbd33a39e2b094e56e09649ca3326de232c9218f91531e49f5aaa - Sigstore transparency entry: 1748110782
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 866.6 kB
- 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 |
1d008718f34d69b7221d4a7c84b8c7e20f7753bc369058b5f31d7008c0c700bb
|
|
| MD5 |
a0a8b39b681ed250d13f8868203d1879
|
|
| BLAKE2b-256 |
bb36b2d1918598deffdb8a916c94049b0632cbf5f79c95f3675d9654653711c7
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
wheels.yml on parisxmas/SQLXtraLite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlxtralite-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
1d008718f34d69b7221d4a7c84b8c7e20f7753bc369058b5f31d7008c0c700bb - Sigstore transparency entry: 1748110892
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: sqlxtralite-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 812.1 kB
- 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 |
8d41ccc4cc126ee601e49abae5f4fde20115dbb2b716aff0ef5079c9b2e3280b
|
|
| MD5 |
1231ccafcbd54b4b4c64046047c1220d
|
|
| BLAKE2b-256 |
e309248fec9b97e13f93c005d27887b76f5ac8dffbde2281bcf72085a7942bad
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on parisxmas/SQLXtraLite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlxtralite-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
8d41ccc4cc126ee601e49abae5f4fde20115dbb2b716aff0ef5079c9b2e3280b - Sigstore transparency entry: 1748110601
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@c40d95f431d22bd27aa7443564b65d03d53d1380 -
Trigger Event:
push
-
Statement type: