Skip to content

Commit 88a3679

Browse files
authored
fix: ignore cluster_by config for embedded model kind (#5409)
1 parent 513e481 commit 88a3679

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

sqlmesh/dbt/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,11 @@ def to_sqlmesh(
539539
optional_kwargs["partitioned_by"] = partitioned_by
540540

541541
if self.cluster_by:
542-
if isinstance(kind, ViewKind):
542+
if isinstance(kind, (ViewKind, EmbeddedKind)):
543543
logger.warning(
544-
"Ignoring cluster_by config for model '%s'; cluster_by is not supported for views.",
544+
"Ignoring cluster_by config for model '%s'; cluster_by is not supported for %s.",
545545
self.name,
546+
"views" if isinstance(kind, ViewKind) else "ephemeral models",
546547
)
547548
else:
548549
clustered_by = []

tests/dbt/test_transformation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,17 @@ def test_model_cluster_by():
20742074
)
20752075
assert model.to_sqlmesh(context).clustered_by == []
20762076

2077+
model = ModelConfig(
2078+
name="model",
2079+
alias="model",
2080+
package_name="package",
2081+
target_schema="test",
2082+
cluster_by=["Bar", "qux"],
2083+
sql="SELECT * FROM baz",
2084+
materialized=Materialization.EPHEMERAL.value,
2085+
)
2086+
assert model.to_sqlmesh(context).clustered_by == []
2087+
20772088

20782089
def test_snowflake_dynamic_table():
20792090
context = DbtContext()

0 commit comments

Comments
 (0)