Skip to content

dbt Core 2.0 parity: Materialization table #702

Closed

Description

@koletzilla

Sub-issue of #660 — feature-parity tracking for the ClickHouse adapter in dbt Core 2.0 / Fusion versus the Python dbt-clickhouse adapter.

Covers the table materialization. On main a table model builds through v1's skeleton (get_create_table_as_sql, backup/intermediate relations, EXCHANGE rebuilds, cleanup tail) with every DDL config, indexes/projections (incl. index-type), sql_header, column codec/ttl and the MV-target protection (mvs_pointing_to_it / mv_on_schema_change / repopulate_from_mvs_on_full_refresh) working: the materialization is done for v1 parity.

Status legend: ✅ implemented — merged and working on dbt-core 2.0 origin/main · 🟡 partial — partly working on origin/main; Notes say what works vs what fails · 🚧 in progress — implemented in an open PR (linked in Notes) · 🔴 not started — not working anywhere · Combined status "A-🚧->B": the feature is at A on origin/main today; an open PR is driving it to B (🟡 partially working / ✅ fully working)

Feature Subfeatures / details Status Notes (PR)
Materialization: table (overall) ✅ dbt-labs/dbt#15506, #15509, #16023, #16082 (v1 skeleton, DDL configs, projections/indexes, sql_header) + dbt-labs/dbt#16200 (EXCHANGE rebuilds, index-type projections, MV-target protection)
Base create / full refresh v1 skeleton: get_create_table_as_sql, backup + intermediate relations, EXCHANGE TABLES swap with rename fallback, drop-backup cleanup (every table defaults to MergeTree) ✅ Skeleton in dbt-labs/dbt#16082; can_exchange relation state (once-per-process EXCHANGE probe, check_exchange profile flag) in dbt-labs/dbt#16200, so Atomic/Replicated/Shared databases rebuild atomically and the rest take the rename fallback
Configs ✅ All table-level DDL configs, indexes/projections wiring, column-level codec/ttl and sql_header merged; index-type projections via dbt-labs/dbt#16200
engine config Free-form engine clause, passed through verbatim (MergeTree() default, ReplacingMergeTree(ver), AggregatingMergeTree(), …) for tables and incrementals alike ✅ dbt-labs/dbt#15506. No engine-specific wiring, same as dbt Core 1.x: the version column of ReplacingMergeTree and the ORDER BY requirement of *MergeTree are expressed through engine/order_by and validated by the server
order_by config String or list ✅ dbt-labs/dbt#15506
ttl config Table-level TTL clause ✅ dbt-labs/dbt#15506
partition_by config String or list (shared dbt config) ✅ Shared dbt config, already registered
primary_key config Fusion serializes scalars as lists → join-back guard in primary_key_clause ✅ dbt-labs/dbt#15500 (guard); list-of-values + whitespace-trim fix in dbt-labs/dbt#15912
indexes config IndexesConfig accepts {name, definition}; ADD INDEX via ALTER ✅ Config + ALTER macro in dbt-labs/dbt#15509; table path wiring in dbt-labs/dbt#16082
projections config ALTER path (ADD PROJECTION), query-type projections ✅ Key in dbt-labs/dbt#16023; table path wiring in dbt-labs/dbt#16082
Column-level ttl Rendered in column DDL ✅ dbt-labs/dbt#16082
codec column config CODEC(...) in column DDL and schema-change ALTERs ✅ Key in dbt-labs/dbt#16023; column DDL in dbt-labs/dbt#16082; schema-change ALTER path in dbt-labs/dbt#16090
projections index-type (index: key) + validation macros clickhouse_projection_ddl, validate_projection(s), version-gated PROJECTION … INDEX … TYPE basic ✅ dbt-labs/dbt#16200 (table.sql synced from v1; invalid projections fail before any DDL runs)
sql_header config Prepended to the CREATE statement ✅ Works since dbt-labs/dbt#16082. The header runs as its own statement (dbt Core 2.0 splits statements), so there is no Python-style "Multi-statements" driver error
Related to MVs pointing to the table ✅ Whole pipeline merged in dbt-labs/dbt#16200
relation.mvs_pointing_to_it Catalog mv_sources CTE + MV-target regex; feeds mv_on_schema_change / repopulation ✅ Consumer macro clickhouse__get_dbt_mvs_for_target in dbt-labs/dbt#16079; catalog stamping in dbt-labs/dbt#16200
mv_on_schema_change config Protects MV-target tables (defaults to fail for MV targets); append_new_columns/sync_all_columns alter in place ✅ Key registered (dbt-labs/dbt#15507), check_incremental_schema_changes in dbt-labs/dbt#16090, table.sql behaviour in dbt-labs/dbt#16200
repopulate_from_mvs_on_full_refresh config Replays MV stored SELECTs into the staging table on --full-refresh ✅ Key registered (dbt-labs/dbt#15507); behaviour in dbt-labs/dbt#16200

Related issues:

Activity

  1. koletzilla commented on Sep 8, 2026

    @koletzilla
    ContributorAuthor

    Closing: every table-specific feature is merged and working on dbt Core 2.0 main (EXCHANGE rebuilds, index-type projections and MV-target protection landed with dbt-labs/dbt#16200). The remaining gaps for table models are cross-materialization and tracked in #711 (grants, ON CLUSTER).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions