Skip to main content

Connect to ClickHouse

You can define the external table and use it to read data from the ClickHouse table, or write to it.

Connect to a local ClickHouse

Example SQL to connect to a local ClickHouse server without password:

CREATE EXTERNAL TABLE ch_local
SETTINGS type='clickhouse',
address='localhost:9000',
table='events'

Connect to ClickHouse Cloud

Example SQL to connect to ClickHouse Cloud:

CREATE EXTERNAL TABLE ch_cloud
SETTINGS type='clickhouse',
address='abc.clickhouse.cloud:9440',
user='default',
password='..',
secure=true,
table='events';

Connect to Aiven for ClickHouse

Example SQL to connect to Aiven for ClickHouse:

CREATE EXTERNAL TABLE ch_aiven
SETTINGS type='clickhouse',
address='abc.aivencloud.com:28851',
user='avnadmin',
password='..',
secure=true,
table='events';