Summary
Add ClickHouse as a supported dialect in mountainash-data's IbisBackend, enabling IbisBackend(dialect="clickhouse", ...) connections.
Motivation
While building a PoC connecting mountainash to ClickHouse (via raw ibis.clickhouse.connect()), it became clear that the connection should go through mountainash-data's IbisBackend for consistency with the rest of the framework. ClickHouse is currently not one of the 12 registered dialects.
Scope
Follow the existing data-driven dialect registration pattern:
-
Settings class — ClickHouseAuthSettings in core/settings/clickhouse.py with a BackendDescriptor covering:
HOST, PORT (default 9000, or 443 for HTTPS/native), DATABASE
SECURE (bool, for TLS — common with cloud-hosted ClickHouse)
USER, PASSWORD (via PasswordAuth)
-
Dialect registration — DialectSpec entry in backends/ibis/dialects/_registry.py:
ibis_backend_name: "clickhouse"
connection_mode: KWARGS
connection_string_scheme: "clickhouse://"
connection_builder: maps settings to ibis.clickhouse.connect(**kwargs)
-
Optional dependency — ibis-framework[clickhouse] under a [clickhouse] extra in pyproject.toml
-
Constants — Add CLICKHOUSE to CONST_DB_PROVIDER_TYPE enum
Expected Usage
from mountainash_data import IbisBackend
# Dialect + kwargs
with IbisBackend(dialect="clickhouse", host="sql-clickhouse.clickhouse.com", port=443, user="demo", database="pypi", secure=True) as backend:
tables = backend.list_tables()
info = backend.inspect_table("pypi_downloads_per_day")
# URL form
with IbisBackend("clickhouse://demo@sql-clickhouse.clickhouse.com:443/pypi?secure=true") as backend:
...
# Settings-driven
params = SettingsParameters.create(
settings_class=ClickHouseAuthSettings,
HOST="sql-clickhouse.clickhouse.com",
PORT=443,
DATABASE="pypi",
SECURE=True,
auth=PasswordAuth(username="demo", password=""),
)
with IbisBackend(params) as backend:
...
Notes
- ibis-framework 12.0.0 supports ClickHouse via
ibis.clickhouse.connect() with kwargs: host, port, user, password, database, secure
- No special DDL hooks needed initially (ClickHouse uses standard SQL for most operations)
- The existing PostgreSQL and MySQL dialect registrations are good templates to follow
Summary
Add ClickHouse as a supported dialect in mountainash-data's
IbisBackend, enablingIbisBackend(dialect="clickhouse", ...)connections.Motivation
While building a PoC connecting mountainash to ClickHouse (via raw
ibis.clickhouse.connect()), it became clear that the connection should go through mountainash-data'sIbisBackendfor consistency with the rest of the framework. ClickHouse is currently not one of the 12 registered dialects.Scope
Follow the existing data-driven dialect registration pattern:
Settings class —
ClickHouseAuthSettingsincore/settings/clickhouse.pywith aBackendDescriptorcovering:HOST,PORT(default 9000, or 443 for HTTPS/native),DATABASESECURE(bool, for TLS — common with cloud-hosted ClickHouse)USER,PASSWORD(viaPasswordAuth)Dialect registration —
DialectSpecentry inbackends/ibis/dialects/_registry.py:ibis_backend_name:"clickhouse"connection_mode:KWARGSconnection_string_scheme:"clickhouse://"connection_builder: maps settings toibis.clickhouse.connect(**kwargs)Optional dependency —
ibis-framework[clickhouse]under a[clickhouse]extra inpyproject.tomlConstants — Add
CLICKHOUSEtoCONST_DB_PROVIDER_TYPEenumExpected Usage
Notes
ibis.clickhouse.connect()with kwargs:host,port,user,password,database,secure