Skip to main content
ClickHouse Connect is a core database driver providing interoperability with a wide range of Python applications.
  • The main interfaces are the synchronous Client and native aiohttp-based AsyncClient in clickhouse_connect.driver. The driver package also provides query and insert contexts, streaming helpers, DB-API support, and lower-level HTTP methods.
  • The clickhouse_connect.datatypes package serializes and deserializes ClickHouse types using the ClickHouse Native binary columnar format.
  • The optional Cython extensions in clickhouse_connect.driverc accelerate common serialization, conversion, and buffering paths. A pure Python path remains available on platforms where the extensions cannot be built.
  • The package ships PEP 561 type information, so downstream type checkers consume annotations for the public driver, DB-API, and SQLAlchemy surfaces.
  • The SQLAlchemy dialect in clickhouse_connect.cc_sqlalchemy supports SQLAlchemy Core, schema reflection, ClickHouse-specific query clauses and table engines, and Alembic migrations. Basic ORM reads and inserts work, but the dialect is designed for analytical workloads rather than full unit-of-work ORM behavior.
  • The core driver and ClickHouse Connect SQLAlchemy implementation are the preferred method for connecting ClickHouse to Apache Superset. Use the ClickHouse Connect database connection, or clickhousedb SQLAlchemy dialect connection string.
This documentation is current as of clickhouse-connect 1.6.0. If you are upgrading from 0.15.x or earlier, see the 1.0 migration guide.
The standard ClickHouse Connect clients use the HTTP interface. This supports HTTP load balancers, proxies, and common enterprise network controls. ClickHouse Connect also has an experimental in-process chDB backend.

Requirements and compatibility

The package includes compiled wheels where available and falls back to a pure Python implementation when the Cython extensions cannot be built. PyArrow is supported on Python 3.10 through 3.14. Python 3.14 requires PyArrow 22 or later.

Installation

Install ClickHouse Connect from PyPI via pip:
Optional integrations are installed through extras:
ClickHouse Connect can also be installed from source:
  • git clone the GitHub repository.
  • Change to the project root and run pip install .. The build system installs Cython automatically to compile the optional C extensions.
The installed version is available as clickhouse_connect.__version__.

Support policy

Update to the latest ClickHouse Connect release before reporting an issue. File issues in the GitHub project. ClickHouse Connect targets the actively supported ClickHouse releases at the time of each driver release. It often works with older server versions, but newer data types and protocol features can require a newer server.

Basic usage

Gather your connection details

To connect to ClickHouse with HTTP(S) you need this information: The details for your ClickHouse Cloud service are available in the ClickHouse Cloud console. Select a service and click Connect:
ClickHouse Cloud service connect button
Choose HTTPS. Connection details are displayed in an example curl command.
ClickHouse Cloud HTTPS connection details
If you’re using self-managed ClickHouse, the connection details are set by your ClickHouse administrator.

Establish a connection

There are two examples shown for connecting to ClickHouse:
  • Connecting to a ClickHouse server on localhost.
  • Connecting to a ClickHouse Cloud service.

Use a ClickHouse Connect client instance to connect to a ClickHouse server on localhost:

Use a ClickHouse Connect client instance to connect to a ClickHouse Cloud service:

Use the connection details gathered earlier. ClickHouse Cloud services require TLS, so use port 8443.

Interact with your database

To run a ClickHouse SQL command, use the client command method:
To insert batch data, use the client insert method with a two-dimensional array of rows and values:
To retrieve data using ClickHouse SQL, use the client query method:

Embedded chDB backend

The experimental chDB backend runs ClickHouse queries inside the Python process without an HTTP server. Install the chdb extra, then select the backend with interface="chdb" or a chdb:// DSN:
The default database is in memory. Pass path="/data/my_chdb" or use dsn="chdb:///data/my_chdb" for persistent storage. chDB allows one engine path per process. It does not support the async client or external data.
Last modified on July 23, 2026