Skip to content

Commit 55918ae

Browse files
authored
categorize changes to MVs as breaking
1 parent 9d10d01 commit 55918ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sqlmesh/core/plan/builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,12 @@ def _categorize_snapshot(
674674
if mode == AutoCategorizationMode.FULL:
675675
snapshot.categorize_as(SnapshotChangeCategory.BREAKING, forward_only)
676676
elif self._context_diff.indirectly_modified(snapshot.name):
677+
if snapshot.is_materialized_view:
678+
# We categorize changes as breaking to allow for instantaneous switches in a virtual layer.
679+
# Otherwise, there might be a potentially long downtime during MVs recreation.
680+
snapshot.categorize_as(SnapshotChangeCategory.BREAKING, forward_only)
681+
return
682+
677683
all_upstream_forward_only = set()
678684
all_upstream_categories = set()
679685
direct_parent_categories = set()

0 commit comments

Comments
 (0)