SQLAlchemy 2.0 dialect for dqlite distributed SQLite
Project description
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; noAUTOCOMMIT. - 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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlalchemy_dqlite-0.3.0.tar.gz.
File metadata
- Download URL: sqlalchemy_dqlite-0.3.0.tar.gz
- Upload date:
- Size: 234.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7381df103f0d791e87a0355cd79a2b0ff24be501aa88e2e85aa16df6bf29ae65
|
|
| MD5 |
5d4ced6831754244fb7ecafa0f45f775
|
|
| BLAKE2b-256 |
d15cf745def173d2f941fc1926102d47cbad4715b3aa23981a1499de1cb5594e
|
Provenance
The following attestation bundles were made for sqlalchemy_dqlite-0.3.0.tar.gz:
Publisher:
publish-to-pypi.yml on letsdiscodev/sqlalchemy-dqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_dqlite-0.3.0.tar.gz -
Subject digest:
7381df103f0d791e87a0355cd79a2b0ff24be501aa88e2e85aa16df6bf29ae65 - Sigstore transparency entry: 1700270087
- Sigstore integration time:
-
Permalink:
letsdiscodev/sqlalchemy-dqlite@4cd4fc141468c1a12d887f2e0be795bc813bb0be -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/letsdiscodev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4cd4fc141468c1a12d887f2e0be795bc813bb0be -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlalchemy_dqlite-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_dqlite-0.3.0-py3-none-any.whl
- Upload date:
- Size: 49.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce70b12c2c260494ec29d99188b26c0ed4896d96a0aac15f7998c4fcbc4ddfef
|
|
| MD5 |
58f408d5ef0816982269a6453ec6e392
|
|
| BLAKE2b-256 |
4d5746a79ae06adfdee82a73b55f68336db4fa9a4ae4f53576f04bbcbdf310ef
|
Provenance
The following attestation bundles were made for sqlalchemy_dqlite-0.3.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on letsdiscodev/sqlalchemy-dqlite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_dqlite-0.3.0-py3-none-any.whl -
Subject digest:
ce70b12c2c260494ec29d99188b26c0ed4896d96a0aac15f7998c4fcbc4ddfef - Sigstore transparency entry: 1700270197
- Sigstore integration time:
-
Permalink:
letsdiscodev/sqlalchemy-dqlite@4cd4fc141468c1a12d887f2e0be795bc813bb0be -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/letsdiscodev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4cd4fc141468c1a12d887f2e0be795bc813bb0be -
Trigger Event:
push
-
Statement type: