Repository navigation
fix: honor model disable_on_cluster when rebuilding catalog relations (#749) - #820
Open
meat-daemon-404 wants to merge 1 commit into
Open
meat-daemon-404 wants to merge 1 commit into
meat-daemon-404 wants to merge 1 commit into
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #749.
on_cluster_clauseindbt/include/clickhouse/macros/materializations/table.sqlso that inside a node context (this is defined) for object-level DDL (relation is not none and relation.identifier),adapter.should_on_cluster(relation=scope)evaluatesthisinstead of a catalog-loadedexisting_relation.relation.identifierisNone, such ascreate_schema/drop_schema) and outside a node context (run-operation, run-level hooks).tests/unit/test_on_cluster_clause.pycoveringdisable_on_cluster=truerebuilds, normal cluster models withSYNC, schema DDL inside a node context, and calls outside a node context.Checklist
tests/unit/test_on_cluster_clause.py; verified macro rendering directly with Jinja2 and linted withruff check; fullpytestsuite requiresdbt-core/ ClickHouse in CI)Note
Medium Risk
Changes distributed DDL decision logic for all table-level macro paths that use
on_cluster_clause; scope is narrow but affects cluster-wide DDL behavior on rebuilds.Overview
Fixes incorrect ON CLUSTER emission when a model is rebuilt with
disable_on_cluster=truewhile the catalog still reports cluster-capable metadata on the existing relation.The
on_cluster_clausemacro now picks a scope relation: for table-level DDL inside a model run (thisis defined andrelation.identifieris set), it callsadapter.should_on_clusterwiththisinstead of the catalogexisting_relation. Schema-level DDL (identifierisNone) and contexts withoutthisstill use the passed-inrelationunchanged.New unit tests in
test_on_cluster_clause.pyexercise rebuild with cluster disabled onthis, normal ON CLUSTER … SYNC output, schema DDL, and calls outside a node context.Reviewed by Cursor Bugbot for commit 66b9f71. Bugbot is set up for automated code reviews on this repo. Configure here.