elitesql (Python)
Python binding for EliteSQL.
pip install elitesql
Wheels for Linux x86_64/aarch64 (manylinux_2_28) and macOS arm64 ship the
engine (libelitesql) inside the package; Python 3.9 or newer. Until the first
PyPI release, install the wheel attached to a
GitHub Release.
EliteSQL(path): embedded in-process over the C ABI (libelitesql). ctypes releases the GIL on every foreign call, so threads truly parallelize. The library is loaded from the package itself; a source checkout also findstarget/release, andELITESQL_LIB=/pathorEliteSQL(path, lib_path=...)point anywhere else.SidecarClient(socket): client for the sidecar mode (elitesql serve <db> <socket>) for multi-worker deployments (gunicorn, uwsgi).
from elitesql import EliteSQL
with EliteSQL("app.esql") as db:
db.query("CREATE TABLE notes (body text NOT NULL, emb vector(768))")
db.create_text_index("notes", "body")
db.create_vector_index("notes", "emb", quantized=True)
db.query("INSERT INTO notes (body, emb) VALUES (%s, %s)", ["hello world", embedding])
rows = db.query(
"SELECT * FROM notes WHERE body = %(body)s LIMIT %(limit)s",
{"body": "hello world", "limit": 10},
)
hits = db.search_hybrid("notes", text=("body", "hello"), vector=("emb", embedding))
with db.snapshot() as snap:
rows = snap.scan("notes") # stable read while others write
query(sql, params=None) binds parameters without string interpolation.
Sequences use ? or %s; mappings use %(name)s. Supported Python values
include None, booleans, signed 64-bit integers, floats, strings, bytes,
datetime/date/time, JSON dicts/lists and numeric lists for vector columns.
Building and releasing wheels
bash bindings/python/build_wheel.sh builds libelitesql with Cargo, copies
it into the package and produces dist/elitesql-<version>-py3-none-<platform>.whl
(pip install build wheel first). ELITESQL_LIB= reuses an existing library
and ELITESQL_WHEEL_PLATFORM= names the platform tag; Linux wheels meant for
distribution are built inside quay.io/pypa/manylinux_2_28_<arch> so they run
on glibc 2.28 or newer.
The Wheels GitHub workflow does this for Linux x86_64, Linux aarch64 and
macOS arm64 on every v* tag, smoke-tests each wheel from a clean virtualenv,
attaches them to the GitHub Release, and uploads them to PyPI through
trusted publishing when the
repository variable PYPI_PUBLISH is true. One-time setup on PyPI: add a
pending publisher for project elitesql with owner jalbarracinv, repository
elitesql, workflow wheels.yml, environment pypi; then create the pypi
environment in the repository settings and set the variable. The package
version comes from pyproject.toml and should match the tag.
Error codes and retries
Every failure raises EliteSQLError with a stable code (also exposed as
constants on the class). Two questions decide what to do next:
| Code | Constant | Meaning | Retry? |
|---|---|---|---|
| 9 | CONFLICT_RETRY |
Optimistic commit conflict; nothing was published | Yes, the whole transaction (run_transaction does this) |
| 21 | TRANSACTION_EXPIRED |
Sidecar rolled the transaction back at its 30 s deadline | Yes, the whole transaction |
| 11 | UNIQUE_VIOLATION |
Constraint refused the write | No: fix the data |
| 17 | COMMIT_UNKNOWN |
The write is published and visible. Only its durability across a power loss is unknown (a sync failed). Further writes are fenced until the database is reopened | Never blindly. Read back, then decide |
| 1 | IO |
I/O error. Over the sidecar this is also a lost connection or timeout: a commit or autocommit statement that was already sent may have been executed |
Never blindly. Reconnect, read back, then decide |
| 2 | CORRUPT |
On-disk validation failed; see elitesql check and elitesql repair |
No |
| 10 | DATABASE_LOCKED |
Another process holds the directory | Later |
| 13 | READ_ONLY |
Handle opened read-only | No |
| 16 | MEMORY_LIMIT |
Operation exceeds its memory pool; split it | With smaller work |
| 20 | AUTH |
Sidecar token missing or wrong | No |
error.retry_safe is True for 9 and 21; error.maybe_published is True
for 17 and 1. A catch-all except EliteSQLError: retry duplicates rows on
17 and 1: make inserts idempotent (explicit id or a unique key) if you retry
those.
Sidecar timeouts
SidecarClient(..., timeout=seconds) bounds every request. When a request
times out the client closes the connection and raises code 1: the late
response cannot be matched to a later request (every request carries an id the
server echoes, and a mismatch also closes the connection). Create a new
client to continue; an in-progress transaction on the old connection is rolled
back by the server when it notices the disconnect.
Durability notes
EliteSQL(path, durability="balanced"|"fast")acknowledges commits before they reach the disk. A cleanclose()syncs everything acknowledged; an OS crash before that may lose recent commits, never corrupt the database.- On macOS
fsyncdoes not flush the drive's cache. Passfull_fsync=Truein the options (seeEliteSQL.__init__) forsafeto survive a power loss there; it is much slower. Linux needs nothing.
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 elitesql-0.0.1-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: elitesql-0.0.1-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
701d9d628b86e6b14d825d0284717eeb7e7de48ca6da350bd21f0e70e3fdb4ab
|
|
| MD5 |
3237b28244c4f23210491521dc2df19b
|
|
| BLAKE2b-256 |
0bcf030a399d1f5548f695f525476c3d26847bb14fcbb318036a051ef63ac4f6
|
Provenance
The following attestation bundles were made for elitesql-0.0.1-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on jalbarracinv/elitesql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elitesql-0.0.1-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
701d9d628b86e6b14d825d0284717eeb7e7de48ca6da350bd21f0e70e3fdb4ab - Sigstore transparency entry: 2810945868
- Sigstore integration time:
-
Permalink:
jalbarracinv/elitesql@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/jalbarracinv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file elitesql-0.0.1-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: elitesql-0.0.1-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c274591cb6e9a5700228af9a0865e3f80fe5e6c9b352d2a0675e4de91410d4a
|
|
| MD5 |
8766b4f7524c2e948adbba87be5bf1e9
|
|
| BLAKE2b-256 |
c9712e64a70df14f4585b8801f85a4e20858dc247597deae82492a94a85669a1
|
Provenance
The following attestation bundles were made for elitesql-0.0.1-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
wheels.yml on jalbarracinv/elitesql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elitesql-0.0.1-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
6c274591cb6e9a5700228af9a0865e3f80fe5e6c9b352d2a0675e4de91410d4a - Sigstore transparency entry: 2810945823
- Sigstore integration time:
-
Permalink:
jalbarracinv/elitesql@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/jalbarracinv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file elitesql-0.0.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: elitesql-0.0.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68abee4b6947d9c2b6f9e0388babff9649aea26c68b716e16b17b8255963f26c
|
|
| MD5 |
03f972b86cf551e1cb922e43c6bd3894
|
|
| BLAKE2b-256 |
4a09fd8d39502bc6b16c8b35a85b087d458f2ee246dbb1e2f77ccf836c5a51c5
|
Provenance
The following attestation bundles were made for elitesql-0.0.1-py3-none-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on jalbarracinv/elitesql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elitesql-0.0.1-py3-none-macosx_11_0_arm64.whl -
Subject digest:
68abee4b6947d9c2b6f9e0388babff9649aea26c68b716e16b17b8255963f26c - Sigstore transparency entry: 2810945898
- Sigstore integration time:
-
Permalink:
jalbarracinv/elitesql@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/jalbarracinv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@b8c1465d52eaef75824dad57d32d7be71ad1cf43 -
Trigger Event:
workflow_dispatch
-
Statement type: