Python (DB-API 2.0) binding for SQLXtraLite — a from-scratch SQL engine in Rust
Project description
sqlxtralite
An embedded SQL database for Python — a single file, no server, no setup. It speaks
the familiar DB-API 2.0 interface and returns native Python types
(int, float, str, bytes, None).
Install
pip install sqlxtralite
Quick start
import sqlxtralite
con = sqlxtralite.connect("shop.db") # opens (or creates) one file
cur = con.cursor()
cur.execute("CREATE TABLE items (id INTEGER PRIMARY KEY, name TEXT, price REAL)")
cur.execute("INSERT INTO items VALUES (1, 'basil', 2.95)")
cur.execute("SELECT name, price FROM items")
print(cur.fetchall()) # [('basil', 2.95)]
con.close()
Parameters & bulk insert
# qmark (?) placeholders; None -> NULL
cur.execute("INSERT INTO items VALUES (?, ?, ?)", (2, "mint", None))
# insert many rows at once
cur.executemany(
"INSERT INTO items VALUES (?, ?, ?)",
[(3, "sage", 4.20), (4, "thyme", 1.50)],
)
cur.execute("SELECT name FROM items WHERE price > ?", (2.0,))
print([row[0] for row in cur.fetchall()]) # ['basil', 'sage']
Fetching results
cur.execute("SELECT id, name FROM items ORDER BY id")
cur.fetchone() # (1, 'basil') — next row, or None at the end
cur.fetchmany(2) # [(2, 'mint'), (3, 'sage')]
cur.fetchall() # the rest
print([d[0] for d in cur.description]) # column names: ['id', 'name']
print(cur.rowcount, cur.lastrowid)
Queries it supports
# joins, aggregates, grouping
cur.execute("""
SELECT name, SUM(price) AS total
FROM items
GROUP BY name
HAVING total > 1
ORDER BY total DESC
""")
# CASE, UNION, subqueries, REPLACE, INSERT ... ON DUPLICATE KEY UPDATE, …
cur.execute("INSERT INTO items VALUES (1, 'basil', 9.99) "
"ON DUPLICATE KEY UPDATE price = VALUES(price)")
API
connect(path) → Connection. Module flags: apilevel = "2.0",
paramstyle = "qmark", threadsafety = 1. Errors raise sqlxtralite.Error.
| Object | Methods / attributes |
|---|---|
Connection |
cursor(), execute(sql, params=None), commit(), rollback(), close(), with support |
Cursor |
execute(sql, params=None), executemany(sql, rows), fetchone(), fetchmany(size=1), fetchall(), description, rowcount, lastrowid, close() |
Notes
- Use one connection per thread.
- Each statement auto-commits; for multi-statement transactions issue explicit
BEGIN/COMMITwithexecute.
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.2-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: sqlxtralite-0.1.2-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 748.0 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 |
2ad9dd1f9d7d89be2bc5ddcc9f06d6a349fbfe77ab0fec51a2e1c048f3b84d5b
|
|
| MD5 |
cc71c4f99abc3541c7a3116346f465b6
|
|
| BLAKE2b-256 |
5dd9865f9eead4e4ffe267cd64e753740927a8d264975a70abda8ebf0b3c187a
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.2-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.2-cp38-abi3-win_amd64.whl -
Subject digest:
2ad9dd1f9d7d89be2bc5ddcc9f06d6a349fbfe77ab0fec51a2e1c048f3b84d5b - Sigstore transparency entry: 1748569649
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: sqlxtralite-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 911.9 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 |
2df8ba7c06785d5b8452844a09ed5effb9d061d2cebe486b5138241cdee0efc8
|
|
| MD5 |
c1e08e8fd439fd1c337b65c7a6539e7d
|
|
| BLAKE2b-256 |
d98dcbf41a2b17f253d23c87a41b1903a7325e5ac9a487d3a7a24a3532246d78
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.2-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.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
2df8ba7c06785d5b8452844a09ed5effb9d061d2cebe486b5138241cdee0efc8 - Sigstore transparency entry: 1748569543
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: sqlxtralite-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 866.9 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 |
ac667c95497edc1943f0bc145876769090af939fb4b0d6ee2916198c46e57ce2
|
|
| MD5 |
205b3b31699b8069965884fec92142d3
|
|
| BLAKE2b-256 |
c7b414fd8615afd5a2d71c43bfe51d13a00f0c09166668671cd2f4c2ca33c90c
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.2-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.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
ac667c95497edc1943f0bc145876769090af939fb4b0d6ee2916198c46e57ce2 - Sigstore transparency entry: 1748569759
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlxtralite-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: sqlxtralite-0.1.2-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 |
fae99aefab3d7e515146ec775f7fe3c3fb2bedfc71ec9a5f284fc88d5908393e
|
|
| MD5 |
cbc1125fee6749646f7eac674ad898a3
|
|
| BLAKE2b-256 |
beaf4f8867a8609fc2073ed943717258879d82f5da364bff9d54d55e0989a778
|
Provenance
The following attestation bundles were made for sqlxtralite-0.1.2-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.2-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
fae99aefab3d7e515146ec775f7fe3c3fb2bedfc71ec9a5f284fc88d5908393e - Sigstore transparency entry: 1748569863
- Sigstore integration time:
-
Permalink:
parisxmas/SQLXtraLite@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/parisxmas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@51a03d2d7818ac4d84c9fda0b56dfdb83d589578 -
Trigger Event:
push
-
Statement type: