These are the main options for a clickhouse integration dbt setup:
- dbt → ClickHouse® via dbt-clickhouse community adapter (self-managed or ClickHouse® Cloud)
- dbt → ClickHouse® Cloud via the official dbt Cloud + ClickHouse® Cloud connection
- dbt → Tinybird as the ClickHouse®-powered transformation and serving layer
dbt (data build tool) is the most widely adopted SQL-based transformation framework for data teams. ClickHouse® is a columnar OLAP database that handles billions of rows in sub-second queries. Connecting the two lets data engineers run dbt run against ClickHouse® tables, materialise models as ClickHouse® views and tables, and serve fast analytical queries downstream.
A clickhouse integration dbt pipeline lets teams use familiar dbt concepts — models, refs, tests, seeds — while gaining ClickHouse®'s columnar performance for the transformation layer. This is especially valuable for teams whose dbt models run against BigQuery or Snowflake today but need sub-second query performance on large datasets at lower cost.
Before you pick a path, consider these questions:
- Do you need full dbt feature parity (tests, docs, snapshots, seeds) or primarily the model + materialisation workflow?
- Is your ClickHouse® self-managed, or are you using ClickHouse® Cloud?
- Do you also need to expose transformed data as REST APIs for applications, or is the output consumed only by BI tools?
Three ways to implement clickhouse integration dbt
This section covers the three main integration paths, with configuration and model code for each.
Option 1: dbt → ClickHouse® — dbt-clickhouse community adapter
The most direct approach. The dbt-clickhouse community adapter translates dbt's materialisation patterns (view, table, incremental) into ClickHouse®-native DDL and DML. Install it alongside dbt-core, configure a ClickHouse® profile, and run dbt run against your ClickHouse® instance.
How it works: the adapter connects to ClickHouse® via the HTTP interface (port 8443 for TLS) using clickhouse-connect. Each dbt model compiles to a ClickHouse® CREATE VIEW, CREATE TABLE AS SELECT, or INSERT INTO … SELECT depending on materialisation. ClickHouse®-specific materialisation settings are passed via config() blocks.
Installation:
pip install dbt-clickhouse
profiles.yml configuration:
clickhouse_project:
target: dev
outputs:
dev:
type: clickhouse
schema: analytics
host: your-clickhouse-host
port: 8443
user: dbt_user
password: "{{ env_var('CLICKHOUSE_PASSWORD') }}"
secure: true
verify: true
connect_timeout: 10
send_receive_timeout: 300
sync_request_timeout: 5
compress_block_size: 1048576
compression: ""
database: analytics
database_engine: Atomic
cluster: ""
dbt model — incremental materialisation with ClickHouse®-specific settings:
-- models/events_daily.sql
{{
config(
materialized='incremental',
engine='ReplacingMergeTree(updated_at)',
order_by='(event_date, event_type, country)',
partition_by='toYYYYMM(event_date)',
unique_key='(event_date, event_type, country)',
incremental_strategy='delete+insert'
)
}}
SELECT
toDate(event_time) AS event_date,
event_type,
country,
count() AS total_events,
uniq(user_id) AS unique_users,
sum(revenue) AS total_revenue,
now() AS updated_at
FROM {{ source('raw', 'events') }}
WHERE event_time >= today() - INTERVAL 1 DAY
