skillfed

clickhouse-sqlalchemy

Simple ClickHouse SQLAlchemy Dialect

clickhouse-sqlalchemy v0.3.2 2.1M downloads/30d#3,306 on PyPI483
Permissive license MIT Active released

What it is and what it does

ClickHouse SQLAlchemy is a SQLAlchemy dialect that bridges Python's SQLAlchemy ORM to ClickHouse, an open-source columnar database. It lets you define tables, insert data, and query ClickHouse using familiar SQLAlchemy patterns—Column definitions, declarative base classes, and session queries—rather than raw SQL or ClickHouse-specific clients. The dialect supports three transport mechanisms: native TCP (recommended), async TCP via asynch, and HTTP via requests, giving you flexibility in how your application connects to ClickHouse.

The package is in Beta status and has been actively maintained, with recent commits and a modest but stable user base. It supports Python 3.7 through 3.12 and declares no runtime dependencies, though you must separately install whichever transport library your application needs. This design keeps the package lightweight but places the burden of dependency management on you.

Use it for:

  • Build a Python web application that stores analytics events in ClickHouse using SQLAlchemy ORM patterns instead of raw SQL.
  • Query ClickHouse tables from a data science notebook using declarative table definitions and session queries.
  • Integrate ClickHouse as a backend for a Python application that already uses SQLAlchemy for other databases.
  • Set up async queries to ClickHouse in a high-concurrency service using the asynch transport.
  • Migrate from another SQLAlchemy-supported database to ClickHouse with minimal ORM code changes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SQLAlchemy dialect for ClickHouse that enables ORM-style database access via native TCP, async TCP, or HTTP interfaces.

Yes, if you are already committed to SQLAlchemy and need ClickHouse support. The dialect is actively maintained, permissively licensed, and has no dependency bloat. However, you must manually install clickhouse-driver, asynch, or requests depending on your transport choice—verify this requirement before adding it to your project.

Install

clickhouse-sqlalchemy on PyPI

pip

pip install clickhouse-sqlalchemy

uv

uv add clickhouse-sqlalchemy

poetry

poetry add clickhouse-sqlalchemy

Installing clickhouse-sqlalchemy

Before you install

High install friction: the package declares no runtime dependencies, but the description indicates it requires one of clickhouse-driver, asynch, or requests to function—you must install the appropriate transport layer separately.

License in practice

MIT license is permissive; you can use this package in commercial and proprietary projects with minimal restrictions, provided you include the license notice.

Quickstart

pip install clickhouse-sqlalchemy
from sqlalchemy import create_engine
from clickhouse_sqlalchemy import make_session, get_declarative_base
uri = 'clickhouse+native://localhost/default'
engine = create_engine(uri)
session = make_session(engine)

You must separately install clickhouse-driver, asynch, or requests depending on your chosen transport (native, async native, or HTTP respectively).

Verify before relying

  • Whether clickhouse-driver, asynch, or requests are truly optional or whether at least one is required at runtime
  • Current state of async support via asynch and whether it is production-ready
  • Whether the package works with ClickHouse versions released after the latest release date

Package facts

License MIT (permissive)
Python support supports the current Python release (<4,>=3.7)
Install friction high — source build required
Runtime dependencies none
Maintenance actively maintained — 793 days since the last release
Last repo commit
First released
Downloads 2,082,006/month — #3,306 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: clickhouse-sqlalchemy-0.3.2.tar.gz

Keywords: ClickHouse, db, database, cloud, analytics

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: SQLTopic :: DatabaseTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules

Tags

clickhouse sqlalchemy dialectclickhouse orm pythonsqlalchemy clickhouse driverclickhouse database adapterclickhouse python client
sqlalchemy-dialectclickhouse-integrationanalytics-db

More Software Development packages

typing-extensions

Provides backported and experimental type hints…

permissive · top 100 on PyPI

numpy

NumPy provides an N-dimensional array object…

permissive · top 100 on PyPI

fastapi

FastAPI is a Python web framework for building…

permissive · top 100 on PyPI

annotated-doc

Provides a way to document function parameters,…

permissive · top 100 on PyPI

typer

Typer builds command-line applications from…

permissive · top 1,000 on PyPI

distlib

Distlib provides low-level packaging utilities…

permissive · top 1,000 on PyPI

clickhouse-connect

A Python database driver for ClickHouse that…

permissive · top 1,000 on PyPI

clickhouse-migrations

Applies versioned SQL migrations to ClickHouse…

permissive · top 15,000 on PyPI

django-clickhouse

Integrates Django applications with ClickHouse,…

permissive · top 15,000 on PyPI

clickhouse-driver

A native TCP driver for ClickHouse that…

permissive · top 5,000 on PyPI

clickhouse-pool

Provides a thread-safe connection pool for…

copyleft · top 5,000 on PyPI

sqlalchemy-cockroachdb

A SQLAlchemy dialect that enables ORM and SQL…

permissive · top 5,000 on PyPI

asynch

asynch is an asynchronous ClickHouse driver…

permissive · top 5,000 on PyPI

sqlalchemy-jdbcapi

SQLAlchemy dialect for JDBC and ODBC database…

permissive · top 15,000 on PyPI

sqlalchemy-solr

Provides a SQLAlchemy dialect that allows you…

permissive · top 15,000 on PyPI

sqlalchemy-spanner

Provides a SQLAlchemy dialect that enables…

permissive · top 5,000 on PyPI