ClickHouse / ClickHouse/dbt-clickhouse

Option to alter table attached to Materialized View on schema changes

Open
#474 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
362
Forks
177
Avg merge
2d 10h
Merged PRs (30d)
8

Description

**Is your feature request related to a problem? Please describe.**

When the query underlying the MV is changed, and we run the dbt model over the existing MV, an update to the MV will be triggered. However, the table attached to the MV remains unchanged, even if schema changes have occurred. This can lead to schema mismatches or runtime issues.

**Describe the solution you'd like**

I would be helpful to have a dbt model configuration option to alter the table when schema changes are detected. This would ensure consistency between the MV query and the attached table.

**Describe alternatives you've considered**

A pre-hook macro could potentially drop or alter the table, but this requires custom logic and the option of adding a parameter through the dbt model config is more straightforward.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the dbt model configuration and materialized-view handling, then trace how schema changes update the attached table. Done means a model option can detect the change and keep the table consistent with the materialized view, with coverage for the relevant schema-change cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, python
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.