Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
clickhouse-connect
View the source code and contribute on GitHub.
- The main interface is the
Clientobject in the packageclickhouse_connect.driver. That core package also includes assorted helper classes and utility functions used for communicating with the ClickHouse server and “context” implementations for advanced management of insert and select queries. - The
clickhouse_connect.datatypespackage provides a base implementation and subclasses for all non-experimental ClickHouse datatypes. Its primary functionality is serialization and deserialization of ClickHouse data into the ClickHouse “Native” binary columnar format, used to achieve the most efficient transport between ClickHouse and client applications. - The Cython/C classes in the
clickhouse_connect.cdriverpackage optimize some of the most common serializations and deserializations for significantly improved performance over pure Python. - There is a SQLAlchemy dialect in the package
clickhouse_connect.cc_sqlalchemywhich is built off of thedatatypesanddbipackages. This implementation supports SQLAlchemy Core functionality includingSELECTqueries withJOINs (INNER,LEFT OUTER,FULL OUTER,CROSS),WHEREclauses,ORDER BY,LIMIT/OFFSET,DISTINCToperations, lightweightDELETEstatements withWHEREconditions, table reflection, and basic DDL operations (CREATE TABLE,CREATE/DROP DATABASE). While it does not support advanced ORM features or advanced DDL features, it provides robust query capabilities suitable for most analytical workloads against ClickHouse’s OLAP-oriented database. - The core driver and ClickHouse Connect SQLAlchemy implementation are the preferred method for connecting ClickHouse to Apache Superset. Use the
ClickHouse Connectdatabase connection, orclickhousedbSQLAlchemy dialect connection string.
The official ClickHouse Connect Python driver uses the HTTP protocol for communication with the ClickHouse server. This enables HTTP load balancer support and works well in enterprise environments with firewalls and proxies, but has slightly lower compression and performance compared to the native TCP-based protocol, and lacks support for some advanced features like query cancellation. For some use cases, you may consider using one of the Community Python drivers that use the native TCP-based protocol.
Requirements and compatibility
| Python | Platform¹ | ClickHouse | SQLAlchemy² | Apache Superset | Pandas | Polars | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2.x, <3.9 | ❌ | Linux (x86) | ✅ | <25.x³ | 🟡 | <1.4.40 | ❌ | <1.4 | ❌ | ≥1.5 | ✅ | 1.x | ✅ |
| 3.9.x | ✅ | Linux (Aarch64) | ✅ | 25.x³ | 🟡 | ≥1.4.40 | ✅ | 1.4.x | ✅ | 2.x | ✅ | ||
| 3.10.x | ✅ | macOS (x86) | ✅ | 25.3.x (LTS) | ✅ | ≥2.x | ✅ | 1.5.x | ✅ | ||||
| 3.11.x | ✅ | macOS (ARM) | ✅ | 25.6.x (Stable) | ✅ | 2.0.x | ✅ | ||||||
| 3.12.x | ✅ | Windows | ✅ | 25.7.x (Stable) | ✅ | 2.1.x | ✅ | ||||||
| 3.13.x | ✅ | 25.8.x (LTS) | ✅ | 3.0.x | ✅ | ||||||||
| 25.9.x (Stable) | ✅ |
cibuildwheel project. Finally, because ClickHouse Connect can also run as pure Python, the source installation should work on any recent Python installation.
²SQLAlchemy support is limited to Core functionality (queries, basic DDL). ORM features are not supported. See SQLAlchemy Integration Support docs for details.
³ClickHouse Connect generally works well with versions outside the officially supported range.
Installation
Install ClickHouse Connect from PyPI via pip:pip install clickhouse-connect
ClickHouse Connect can also be installed from source:
git clonethe GitHub repository.- (Optional) run
pip install cythonto build and enable the C/Cython optimizations cdto the project root directory and runpip install .
