Skip to content

Commit c9214f9

Browse files
committed
Fix: Match dbt handling of cluster_by config for view materializations
1 parent a58dcf0 commit c9214f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlmesh/dbt/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ def to_sqlmesh(
449449
"""Converts the dbt model into a SQLMesh model."""
450450
model_dialect = self.dialect(context)
451451
query = d.jinja_query(self.sql_no_config)
452+
kind = self.model_kind(context)
452453

453454
optional_kwargs: t.Dict[str, t.Any] = {}
454455
physical_properties: t.Dict[str, t.Any] = {}
@@ -467,7 +468,7 @@ def to_sqlmesh(
467468
partitioned_by.append(self._big_query_partition_by_expr(context))
468469
optional_kwargs["partitioned_by"] = partitioned_by
469470

470-
if self.cluster_by:
471+
if self.cluster_by and not isinstance(kind, ViewKind):
471472
clustered_by = []
472473
for c in self.cluster_by:
473474
try:
@@ -573,7 +574,6 @@ def to_sqlmesh(
573574
if physical_properties:
574575
model_kwargs["physical_properties"] = physical_properties
575576

576-
kind = self.model_kind(context)
577577
allow_partials = model_kwargs.pop("allow_partials", None)
578578
if (
579579
allow_partials is None

0 commit comments

Comments
 (0)