Use Materialization with Explicit Target (Beta)
mainStarting from dbt-clickhouse version 1.10, you can use the explicit target feature to decouple the target table from the materialized views (MVs).
In the default (implicit) approach, dbt manages the target table and all MVs within a single model using UNION ALL. The explicit target approach allows you to define the target table as a standalone table materialization and then reference it from multiple separate materialized_view models. This provides better resource separation, individual configuration for each resource, and easier iteration using dbt tooling.
Note: This feature is in Beta. The API may change.
-- Step 1: Define target table (events_daily.sql)
{{ config(materialized='table', engine='SummingMergeTree()', ...) }}
SELECT ... WHERE 0
-- Step 2: Define MV (page_events_aggregator.sql)
{{ config(materialized='materialized_view') }}
{{ materialization_target_table(ref('events_daily')) }}
SELECT ...