dqlite-client
Async Python client for dqlite, Canonical's distributed SQLite. It connects to a dqlite cluster, finds the current Raft leader, runs SQL, and pools connections.
The API is inspired by asyncpg's
ergonomics — explicit connect() / create_pool(), fetch / fetchall
/ fetchval, and context-manager transactions — with a deliberately
simple data model: fetch returns list[dict], fetchall returns
list[list], fetchval returns a scalar. There is no Record type.
Is this the package you want?
Use dqlite-client directly when you want a lightweight async client
with no ORM or DB-API layer, or when you need fine-grained control over
cluster bootstrapping and the wire protocol.
If you want a standard PEP 249 driver, SQLAlchemy, Alembic, or most ORMs, reach for a higher layer instead — see The dqlite Python stack below.
Installation
pip install dqlite-client
Requires Python 3.13+.
Usage
import asyncio
from dqliteclient import connect
async def main():
conn = await connect("localhost:9001")
async with conn.transaction():
await conn.execute("CREATE TABLE IF NOT EXISTS t (id INTEGER PRIMARY KEY, name TEXT)")
await conn.execute("INSERT INTO t (name) VALUES (?)", ["hello"])
rows = await conn.fetch("SELECT * FROM t") # list[dict]
for row in rows:
print(row)
await conn.close()
asyncio.run(main())
Connection pool
from dqliteclient import create_pool
pool = await create_pool(["localhost:9001", "localhost:9002", "localhost:9003"])
async with pool.acquire() as conn:
rows = await conn.fetch("SELECT 1")
The dqlite Python stack
This is one of four layered packages. Each builds on the one below:
| Package | Role |
|---|---|
| sqlalchemy-dqlite | SQLAlchemy 2.0 dialect |
| dqlite-dbapi | PEP 249 (DB-API 2.0) driver — sync & async |
| dqlite-client — this package | Async wire client — pooling, leader discovery |
| dqlite-wire | Wire-protocol codec |
For SQLAlchemy/ORM use, prefer sqlalchemy-dqlite or dqlite-dbapi.
Documentation
- Architecture — layering, the connection lifecycle (a connection that loses its session is closed for good), transaction tracking, leader discovery and the pool.
- Connection pooling — sizing, startup, and leader behavior.
- Deployment: forking & multiprocessing — read this
if you use gunicorn, Celery, or
multiprocessing. dqliteclient.sql— the lexical SQL helpers (comment stripping, top-level statement splitting) the client and the dbapi layer share.- Data types & NULL handling — the row model and a server-version gotcha for NULLs in typed columns.
Development
See DEVELOPMENT.md for setup and contribution guidelines.
License
MIT
Metadata
Release files for dqlite-client 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dqlite_client-0.8.0.tar.gz | 133.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dqlite_client-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.5 kB
Release files / dqlite_client-0.8.0.tar.gz
| Download URL | dqlite_client-0.8.0.tar.gz |
|---|---|
| Size | 133.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ab0f9b15e9dc12bd87b12dfa43cfae5a679ce66677ae6c9bb78f73a118dd7d6
|
|
BLAKE2b-256 checksum How to use checksums |
90034e6a7201dad2eb5bc3bff6f9a7bf2485d81eedb2c08b4d020810074e2809
|
| 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 13, 2026.
Transparency logRelease files / dqlite_client-0.8.0-py3-none-any.whl
| Download URL | dqlite_client-0.8.0-py3-none-any.whl |
|---|---|
| Size | 42.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1c4d6ba8407ac16d44c78aec4599e78784f0e6e10e5204d18487caa734508fd
|
|
BLAKE2b-256 checksum How to use checksums |
ed28a13320cdcbf55cb002738f4640288f79b78a0868043a7ad7c3541d1f0001
|
| 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 13, 2026.
Transparency log