Skip to content

Commit 9cbe531

Browse files
committed
Fix: Match dbt handling of cluster_by config for view materializations
1 parent d774db9 commit 9cbe531

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sqlmesh/dbt/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ def to_sqlmesh(
503503
"""Converts the dbt model into a SQLMesh model."""
504504
model_dialect = self.dialect(context)
505505
query = d.jinja_query(self.sql_no_config)
506+
kind = self.model_kind(context)
506507

507508
optional_kwargs: t.Dict[str, t.Any] = {}
508509
physical_properties: t.Dict[str, t.Any] = {}
@@ -521,7 +522,7 @@ def to_sqlmesh(
521522
partitioned_by.append(self._big_query_partition_by_expr(context))
522523
optional_kwargs["partitioned_by"] = partitioned_by
523524

524-
if self.cluster_by:
525+
if self.cluster_by and not isinstance(kind, ViewKind):
525526
clustered_by = []
526527
for c in self.cluster_by:
527528
try:
@@ -627,7 +628,6 @@ def to_sqlmesh(
627628
if physical_properties:
628629
model_kwargs["physical_properties"] = physical_properties
629630

630-
kind = self.model_kind(context)
631631
allow_partials = model_kwargs.pop("allow_partials", None)
632632
if (
633633
allow_partials is None

0 commit comments

Comments
 (0)