Official ClickHouse Python driver · HTTP · query & insert · pandas / arrow / numpy · verified against clickhouse-connect 1.x (2026)

ClickHouse Connect cheat sheet

clickhouse-connect is ClickHouse's official Python driver, talking to the server over HTTP(S). Make a client with get_client(), then query() for rows, query_df() for a pandas DataFrame, insert() / insert_df() to write, and command() for DDL. It has first-class pandas, NumPy, and Arrow support, streaming for huge result sets, an async client, and powers the ClickHouse SQLAlchemy dialect & Superset connector. Targets clickhouse-connect 1.x, Python 3.9+.

connect & query insert DDL & types streaming & async config & ecosystem gotcha most common

Verified 2026-08-31 against the official docs at clickhouse.com/docs/integrations/python & the GitHub repo (clickhouse-connect 1.7.2, 2026-08-20; Python 3.9+). Uses the HTTP interface (port 8123, or 8443 for HTTPS) — not the native TCP protocol (that's clickhouse-driver).

Outline

One get_client(), then query* to read and insert* to write — each with row, DataFrame, NumPy, and Arrow variants. Stream large results; use command() for DDL.

Connect & query

  1. 1Install & get_client
  2. 2Query rows
  3. 3Query to DataFrame / Arrow

Insert

  1. 4Insert rows
  2. 5Insert DataFrame / Arrow

DDL & types

  1. 6command() & DDL
  2. 7Parameters & settings
  3. 8Types & formats

Streaming, async & ecosystem

  1. 9Streaming large results
  2. 10Async client
  3. 11Config & ecosystem

Connect & Query

Open an HTTP client, run SQL, and get rows or a DataFrame back.

1Install & get_clientHTTP driver
2Query rows.query()
3Query to DataFrame / Arrowanalytics

Insert

Write rows, DataFrames, or Arrow tables — in big batches, the ClickHouse way.

4Insert rows.insert()
5Insert DataFrame / Arrowbulk load

DDL & Types

Run statements, bind parameters, and hand ClickHouse's rich types to Python.

6command() & DDLstatements
7Parameters & settingssafe SQL
8Types & formatsmapping

Streaming & Async

Read results larger than memory, and go concurrent.

9Streaming large resultsbounded memory
10Async clientconcurrency

Config & Ecosystem

Tune the HTTP layer, and see where the driver plugs in.

11Config & ecosystemthe wider stack

Worth memorizing

get_client(host=, port=8123)secure=True -> 8443 (HTTPS)
query().result_rows / .column_names
query_df / query_arrowDataFrame / Arrow Table out
query_npNumPy structured array
insert(table, rows, column_names=)list of row lists
insert_df / insert_arrowbulk-load a DataFrame / Arrow
batch bigtiny inserts make parts — avoid them
command()DDL + single-value queries
{name:Type} + parameters=safe bound params
settings={}per-query ClickHouse settings
query_df_stream / *_streambounded memory over big tables
get_async_client()awaitable, same API