dqlite-dbapi
A PEP 249 (DB-API 2.0) driver for
dqlite, Canonical's distributed SQLite. If you have
used Python's standard sqlite3 module, this will feel familiar — same
connect() / cursor() / execute() / fetchone() shape — but it talks
to a replicated dqlite cluster over the network instead of a local file.
It comes in two flavors from one package: a synchronous API
(dqlitedbapi) and an async API (dqlitedbapi.aio).
Is this the package you want?
Yes, if you want a drop-in-style database driver for dqlite — directly, or under a tool that expects a DB-API 2.0 driver. For SQLAlchemy specifically, use sqlalchemy-dqlite (it builds on this package).
Installation
pip install dqlite-dbapi
Requires Python 3.13+.
Usage
Sync
import dqlitedbapi
conn = dqlitedbapi.connect("localhost:9001")
cur = conn.cursor()
cur.execute("SELECT 1")
print(cur.fetchone())
conn.close()
Async
import asyncio
from dqlitedbapi.aio import aconnect
async def main():
conn = await aconnect("localhost:9001")
cur = conn.cursor()
await cur.execute("SELECT 1")
print(await cur.fetchone())
await conn.close()
asyncio.run(main())
Key facts
apilevel = "2.0",paramstyle = "qmark"(?placeholders),threadsafety = 2.- Autocommit by default. Unlike stdlib
sqlite3, the driver does not auto-BEGINbefore a statement — wrap writes in an explicit transaction when you need atomic multi-statement semantics. See Transactions. - Isolation is always SERIALIZABLE — every write goes through Raft consensus, every read is serializable.
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 — this package | PEP 249 (DB-API 2.0) driver — sync & async |
| dqlite-client | Async wire client — pooling, leader discovery |
| dqlite-wire | Wire-protocol codec |
Using SQLAlchemy or an ORM? Prefer sqlalchemy-dqlite.
Documentation
- Transactions — the autocommit-by-default model and how to group statements.
- Differences from
sqlite3— what to expect when porting from the stdlib module (and a server-version NULL gotcha). - Differences from
aiosqlite— for the async surface. - Architecture — how the sync surface wraps the async core, and the threading, lifecycle, and error-mapping policies.
Development
See DEVELOPMENT.md for setup and contribution guidelines.
License
MIT
Metadata
Release files for dqlite-dbapi 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 | Provenance | Actions |
|---|---|---|---|---|
| dqlite_dbapi-0.8.0.tar.gz | 131.0 kB | With provenance | Details for dqlite_dbapi-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dqlite_dbapi-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for dqlite_dbapi-0.8.0-py3-none-any.whl |
Total release size: 167.5 kB
Release files / dqlite_dbapi-0.8.0.tar.gz
| Download URL | dqlite_dbapi-0.8.0.tar.gz |
|---|---|
| Size | 131.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e17d1124cf98b3caa086e7fba83093b28567624566109613eb8eab9a1b846f63
|
|
BLAKE2b-256 checksum How to use checksums |
57c402de9f7930276fddbdf231facdb992526756a80a375bdffc0a3d1766e0b4
|
| 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_dbapi-0.8.0-py3-none-any.whl
| Download URL | dqlite_dbapi-0.8.0-py3-none-any.whl |
|---|---|
| Size | 36.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e98433dd663a392fbe572290f01cfcf6a3cb354c93013c80a731504b27d42a4e
|
|
BLAKE2b-256 checksum How to use checksums |
67688e2c8351086bdf0cdcd1e51d59c40f367b5c40166065fa02bc733061e8ff
|
| 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 logSecurity for dqlite-dbapi 0.8.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 2 files in this release have been uploaded with provenance metadata.
Attestation for dqlite_dbapi-0.8.0.tar.gz
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 logA 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.