ClickHouse SQLAlchemy
ClickHouse dialect for SQLAlchemy to ClickHouse database.
This is clickhouse-sqlalchemy-ng, a maintained fork of clickhouse-sqlalchemy by Konstantin Lebedev, which has had no release since 0.3.2. It keeps the clickhouse_sqlalchemy import name and the clickhouse:// URL schemes, so it is a drop-in replacement.
Installation
pip install clickhouse-sqlalchemy-ng
Both packages install the same clickhouse_sqlalchemy module, so uninstall the original first: pip uninstall clickhouse-sqlalchemy.
Documentation
Documentation of the original project is available at https://clickhouse-sqlalchemy.readthedocs.io and applies to this fork; see CHANGELOG.md for what changed since 0.3.2.
Usage
Supported interfaces:
native [recommended] (TCP) via clickhouse-driver <https://github.com/mymarilyn/clickhouse-driver>
async native (TCP) via asynch <https://github.com/long2ice/asynch>
http via requests
Define table
from sqlalchemy import create_engine, Column, MetaData from clickhouse_sqlalchemy import ( Table, make_session, get_declarative_base, types, engines ) uri = 'clickhouse+native://localhost/default' engine = create_engine(uri) session = make_session(engine) metadata = MetaData(bind=engine) Base = get_declarative_base(metadata=metadata) class Rate(Base): day = Column(types.Date, primary_key=True) value = Column(types.Int32) __table_args__ = ( engines.Memory(), ) Rate.__table__.create()
Insert some data
from datetime import date, timedelta from sqlalchemy import func today = date.today() rates = [ {'day': today - timedelta(i), 'value': 200 - i} for i in range(100) ]
And query inserted data
session.execute(Rate.__table__.insert(), rates) session.query(func.count(Rate.day)) \ .filter(Rate.day > today - timedelta(20)) \ .scalar()
License
ClickHouse SQLAlchemy is distributed under the MIT license.
Metadata
Release files for clickhouse-sqlalchemy-ng 0.4.1
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 |
|---|---|---|---|---|
| clickhouse_sqlalchemy_ng-0.4.1.tar.gz | 47.4 kB | With provenance | Details for clickhouse_sqlalchemy_ng-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clickhouse_sqlalchemy_ng-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for clickhouse_sqlalchemy_ng-0.4.1-py3-none-any.whl |
Total release size: 103.0 kB
Release files / clickhouse_sqlalchemy_ng-0.4.1.tar.gz
| Download URL | clickhouse_sqlalchemy_ng-0.4.1.tar.gz |
|---|---|
| Size | 47.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a92c4a1c9e6e1a8f1169a64fe3abf5d8afcb0653ccad739dc9f8c319894e12f9
|
|
BLAKE2b-256 checksum How to use checksums |
6bfb1b94a86002f97634f570e3834671bf41428f0ecb45236625261980726190
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 22, 2026.
Transparency logRelease files / clickhouse_sqlalchemy_ng-0.4.1-py3-none-any.whl
| Download URL | clickhouse_sqlalchemy_ng-0.4.1-py3-none-any.whl |
|---|---|
| Size | 55.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4dbbd42f8910463c11332e9915767b9bba43e7c0b037ac296396ca7afdee57d7
|
|
BLAKE2b-256 checksum How to use checksums |
ee15ecd88b99305d8481c81fcfa0309eb48187429e643cadddfe3cbc8d60c0ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 22, 2026.
Transparency logSecurity for clickhouse-sqlalchemy-ng 0.4.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for clickhouse_sqlalchemy_ng-0.4.1.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 Nov 22, 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.