Skip to main content

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. Install from PyPI or use a 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 finds target/release, and ELITESQL_LIB=/path or EliteSQL(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 clean close() syncs everything acknowledged; an OS crash before that may lose recent commits, never corrupt the database.
  • On macOS fsync does not flush the drive's cache. Pass full_fsync=True in the options (see EliteSQL.__init__) for safe to survive a power loss there; it is much slower. Linux needs nothing.

Metadata

Release files for elitesql 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for elitesql 0.1.0
File Interpreter ABI Platform Actions
elitesql-0.1.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for elitesql-0.1.0-py3-none-manylinux_2_28_x86_64.whl
elitesql-0.1.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for elitesql-0.1.0-py3-none-manylinux_2_28_aarch64.whl
elitesql-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for elitesql-0.1.0-py3-none-macosx_11_0_arm64.whl

Total release size: 5.8 MB

Release files / elitesql-0.1.0-py3-none-manylinux_2_28_x86_64.whl

Download URL elitesql-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Size 2.1 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ef2298d3b01c0a1382931142373af1de97f4704a4ef1a51b94318b6e4af4fd92
BLAKE2b-256 checksum
How to use checksums
3ccb55130aa3d8de57d29d380a0d2f97ec21db6bd7aec59e1de28780b8e3a696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / elitesql-0.1.0-py3-none-manylinux_2_28_aarch64.whl

Download URL elitesql-0.1.0-py3-none-manylinux_2_28_aarch64.whl
Size 1.9 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a6b10e586f9c2df78671b65c2e61dd0e3d1b29fdbaf68820d56413088cbb6eeb
BLAKE2b-256 checksum
How to use checksums
ce7ef26ec06e7b81ca75949e7f1903a83e2d6139c2c230631f889d39c3cdf862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / elitesql-0.1.0-py3-none-macosx_11_0_arm64.whl

Download URL elitesql-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 1.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a35e8c5056f1b775d2c358a9e4432ccd62653a6f30760b136c31f435359ed35b
BLAKE2b-256 checksum
How to use checksums
2a6c7136552207f2a6e6c29ce3aac4553ef173fd8b10a4caddcfcc709f9cdb6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Security for elitesql 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for elitesql-0.1.0-py3-none-manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page