Skip to main content

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

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_client-0.4.0.tar.gz (411.7 kB view details)

Uploaded Source

Built Distribution

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

dqlite_client-0.4.0-py3-none-any.whl (100.7 kB view details)

Uploaded Python 3

File details

Details for the file dqlite_client-0.4.0.tar.gz.

File metadata

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

File hashes

Hashes for dqlite_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9bab08a3be43c76891bea5eb360b9bcfe4bb859be0be29688e56b32377e167b6
MD5 58d665cb8dc8de46696e1880a6b5c81c
BLAKE2b-256 b45aac575aac94ec400395018a3700e5355540947c4fc8fec53407b7e8420e01

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_client-0.4.0.tar.gz:

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

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_client-0.4.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dqlite_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b950ec50393ee01ce2fcbe440834c1c4a7ecb65a30812405f6745d749b60b04
MD5 a060303afaa541460b34169275fd86fb
BLAKE2b-256 11b343f269bdc9256cbb948ac508efd1ea31fcc9200fc742d319497016c9cf9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dqlite_client-0.4.0-py3-none-any.whl:

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

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

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

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