Skip to main content

ClickHouse

Connector backed by clickhouse-driver (native TCP) with automatic fallback to clickhouse-connect (HTTP). Supports ClickHouse Cloud, on-premise, and self-hosted. db_type is clickhouse. Tier 2.

Connection config

clickhouse
{
"name": "prod-clickhouse",
"db_type": "clickhouse",
"host": "ch.example.com",
"port": 9000,
"database": "analytics",
"username": "readonly",
"password": "...",
"protocol": "native"
}

Connection fields

FieldRequiredDescription
nameYesConnection name. [a-zA-Z0-9_-], max 64 chars.
db_typeYesclickhouse.
hostYesServer hostname.
portNoDefaults: native 9000 / native+TLS 9440; HTTP 8123 / HTTPS 8443.
databaseNoDefault database (defaults to default).
usernameNoUser (defaults to default).
passwordNoPassword.
protocolNonative or http.
ssl / ssl_configNoTLS. verify-ca / verify-full enable cert verification.
ssh_tunnelNoConnect through a bastion host.
connection_timeoutNoConnect timeout, seconds.
query_timeoutNoMaps to max_execution_time per query.

Protocol fallback: native TCP is tried first; on failure the connector falls back to HTTP, mapping native ports to HTTP ports (9000→8123, 9440→8443, 9100→8124). Connection-string forms: clickhouse://, clickhouses:// (native+TLS), clickhouse+http://, clickhouse+https://.

Capabilities

CapabilitySupportedNotes
QueryYesPer-query timeout via max_execution_time setting.
Schema introspectionYessystem.columns for columns; system.tables for engine, sorting key, primary key, row count, and byte size.
FK discoveryNoClickHouse has no foreign keys.
Primary keysYessystem.columns.is_in_primary_key; also exposes table sorting_key and primary_key.
EXPLAINYesEXPLAIN ESTIMATE (rows/marks per part); falls back to EXPLAIN PLAN parsing rows: N.
Cost estimationYes (estimated)Estimated rows × per-row rate (columnar storage rate).
Schema statsYestotal_rows / total_bytes from system.tables; per-column uncompressed and compressed bytes from system.parts_columns.

Tier 2.

Dialect notes / gotchas

  • Identifiers are quoted with backticks (`col`).
  • Column types are unwrapped during introspection: Nullable(...) sets the column nullable, LowCardinality(...) is flagged via low_cardinality.
  • Engine matters: tables with engine View, MaterializedView, LiveView, or WindowView are reported as views.
  • sorting_key (ORDER BY key) drives query performance — prefer filtering on sorting-key prefixes.
  • The native and HTTP clients are not thread-safe on a single connection; schema queries run sequentially.

Blocked functions

These ClickHouse table/remote functions are blocked inside SELECT (they read external resources):

file, url, s3, s3cluster, mysql, postgresql, remote, remotesecure, hdfs, jdbc, mongo, redis, sqlite, odbc, input, generaterandom, executable, azureblobstorage, deltalake, hudi, iceberg.

The universal load_extension / install_extension block also applies. All DDL/DML statement types are blocked.

sql-workflow — no dedicated ClickHouse skill exists. Covers output-shape inference, schema exploration, CTE-based query building, and the verification loop.

Cloud vs local

Supported in both cloud and local mode. ClickHouse is TCP-connected, so in cloud mode the resolved host is run through SSRF validation: public hostnames are allowed, but RFC1918/loopback/link-local addresses are blocked unless SP_ALLOW_PRIVATE_CONNECTIONS is set. In local mode SSRF validation is disabled.