Skip to main content

sqlalchemy-dqlite

A SQLAlchemy 2.0 dialect for dqlite, Canonical's distributed SQLite. Point SQLAlchemy (and Alembic, and most ORMs built on it) at a dqlite cluster with a dqlite:// URL and use it like any other backend.

It supports both the synchronous and the async SQLAlchemy engines, and builds on dqlite's SQLite roots, so SQLAlchemy treats it as a SQLite-family dialect.

Is this the package you want?

Yes, if you use SQLAlchemy or an ORM/migration tool on top of it (Alembic, Flask-SQLAlchemy, etc.) and want it backed by dqlite. If you want a plain database driver without SQLAlchemy, use dqlite-dbapi.

Installation

pip install sqlalchemy-dqlite

Requires Python 3.13+ and SQLAlchemy 2.0+.

Usage

from sqlalchemy import create_engine, text

engine = create_engine("dqlite://localhost:9001/mydb")
with engine.connect() as conn:
    print(conn.execute(text("SELECT 1")).fetchone())

Async:

from sqlalchemy.ext.asyncio import create_async_engine

engine = create_async_engine("dqlite+aio://localhost:9001/mydb")
async with engine.connect() as conn:
    result = await conn.execute(text("SELECT 1"))
    print(result.fetchone())

URL format: dqlite://host:port/database (or dqlite+aio://… for async). The host:port is the bootstrap node — the cluster is discovered from there. See Connection URL for details.

The dqlite Python stack

This is the top of four layered packages. Each builds on the one below:

Package Role
sqlalchemy-dqlite — this package SQLAlchemy 2.0 dialect
dqlite-dbapi PEP 249 (DB-API 2.0) driver — sync & async
dqlite-client Async wire client — pooling, leader discovery
dqlite-wire Wire-protocol codec

Documentation

  • Transactions — SQLAlchemy owns BEGIN/COMMIT; no AUTOCOMMIT.
  • Connection URL — URL format, the bootstrap address, and query parameters.
  • Limitations & notes — STRICT tables, savepoint naming, and a server-version NULL gotcha.

Development

See DEVELOPMENT.md for setup, contribution guidelines, and how to run the SQLAlchemy compliance test suite.

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

sqlalchemy_dqlite-0.6.0.tar.gz (114.7 kB view details)

Uploaded Source

Built Distribution

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

sqlalchemy_dqlite-0.6.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_dqlite-0.6.0.tar.gz.

File metadata

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

File hashes

Hashes for sqlalchemy_dqlite-0.6.0.tar.gz
Algorithm Hash digest
SHA256 0619e4afe552c0a33507a7211ae70a194e53d39da5afae1e50f85c4421ea3418
MD5 4ac17807e7f5a1cec180af466270da33
BLAKE2b-256 e3b5e4246a2bac48dccb176ad9035cda0c962ece5a3136f8736633a5af025a1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_dqlite-0.6.0.tar.gz:

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

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

File details

Details for the file sqlalchemy_dqlite-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_dqlite-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e06f5f69e6c4b50301a4b1cfda1332bafe25deb14a8e8e507e1f6b42224695a3
MD5 b933935355fd977ad32e57567dec50b0
BLAKE2b-256 ec45edba6d87029e68f702334c7a410160d68cd403b03b7e05be3e2665e27c3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_dqlite-0.6.0-py3-none-any.whl:

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

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

This release

0.6.0 This release

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