Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sqlmesh/dbt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,11 @@ def to_sqlmesh(
optional_kwargs["partitioned_by"] = partitioned_by

if self.cluster_by:
if isinstance(kind, ViewKind):
if isinstance(kind, (ViewKind, EmbeddedKind)):
logger.warning(
"Ignoring cluster_by config for model '%s'; cluster_by is not supported for views.",
"Ignoring cluster_by config for model '%s'; cluster_by is not supported for %s.",
self.name,
"views" if isinstance(kind, ViewKind) else "ephemeral models",
)
else:
clustered_by = []
Expand Down
11 changes: 11 additions & 0 deletions tests/dbt/test_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,17 @@ def test_model_cluster_by():
)
assert model.to_sqlmesh(context).clustered_by == []

model = ModelConfig(
name="model",
alias="model",
package_name="package",
target_schema="test",
cluster_by=["Bar", "qux"],
sql="SELECT * FROM baz",
materialized=Materialization.EPHEMERAL.value,
)
assert model.to_sqlmesh(context).clustered_by == []


def test_snowflake_dynamic_table():
context = DbtContext()
Expand Down