ClickHouse configurations
ClickHouse configurations
View materialization
A dbt model can be created as a ClickHouse view and configured using the following syntax:
- Project YAML file
- SQL file config
models:
<resource-path>:
+materialized: view
{{ config(materialized = "view") }}
Table materialization
A dbt model can be created as a ClickHouse table and configured using the following syntax:
- Project YAML file
- SQL file config
models:
<resource-path>:
+materialized: table
+order_by: [ <column-name>, ... ]
+engine: <engine-type>
+partition_by: [ <column-name>, ... ]
{{ config(
materialized = "table",
engine = "<engine-type>",
order_by = [ "<column-name>", ... ],
partition_by = [ "<column-name>", ... ],
...
]
) }}
Table configuration
| Loading table... |
For the complete list of configuration options, see the ClickHouse documentation.
Incremental materialization
Table model will be reconstructed for each dbt execution. This may be infeasible and extremely costly for larger result sets or complex transformations. To address this challenge and reduce the build time, a dbt model can be created as an incremental ClickHouse table and is configured using the following syntax:
- Project file
- SQL file config
models:
<resource-path>:
+materialized: incremental
+order_by: [ <column-name>, ... ]
+engine: <engine-type>
+partition_by: [ <column-name>, ... ]
+unique_key: [ <column-name>, ... ]
+inserts_only: [ True|False ]
{{ config(
materialized = "incremental",
engine = "<engine-type>",
order_by = [ "<column-name>", ... ],
partition_by = [ "<column-name>", ... ],
unique_key = [ "<column-name>", ... ],
inserts_only = [ True|False ],
...
]
) }}
Incremental table configuration
| Loading table... |
For the complete list of configuration options, see the ClickHouse documentation.
Snapshot
dbt snapshots allow a record to be made of changes to a mutable model over time. This in turn allows point-in-time queries on models, where analysts can “look back in time” at the previous state of a model. This functionality is supported by the ClickHouse connector and is configured using the following syntax:
For more information on configuration, check out the snapshot configs reference page.
Learn more
The dbt-clickhouse adapter supports most dbt-native features like tests, snapshots, helper macros, and more. For a complete overview of supported features and best practices, see the ClickHouse documentation.
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.