Skip to main content

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-BEGIN before 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

Development

See DEVELOPMENT.md for setup and contribution guidelines.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dqlite_dbapi-0.7.0.tar.gz (141.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dqlite_dbapi-0.7.0-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file dqlite_dbapi-0.7.0.tar.gz.

File metadata

  • Download URL: dqlite_dbapi-0.7.0.tar.gz
  • Upload date:
  • Size: 141.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dqlite_dbapi-0.7.0.tar.gz
Algorithm Hash digest
SHA256 0da145e0462cbe84191a745bb27d352fc571aebecd8c291f93ba671abee54f43
MD5 edf9338bc84ddd555fa3dfca2772c938
BLAKE2b-256 03e9b29d224c7ab615014486ab71a32667c7088723b6a6441ec56635a4bf22cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_dbapi-0.7.0.tar.gz:

Publisher: publish-to-pypi.yml on letsdiscodev/python-dqlite-dbapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dqlite_dbapi-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: dqlite_dbapi-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dqlite_dbapi-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 090d316ccb6b44da3b3a946d9b4d1697ff618e2c9426e5510721592cac38bf84
MD5 e55f771e0947e309149264f1cd926f7b
BLAKE2b-256 57248fbd8ee4e27870f6e691a2cda09ecaa376c6c6ec57a4fd62c6852c0197c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_dbapi-0.7.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on letsdiscodev/python-dqlite-dbapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.0

2 files

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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