Skip to content

Commit ea35b3c

Browse files
authored
Fix: Reporting the absence of physical layer updates when explaining a plan (#4760)
1 parent b0535ed commit ea35b3c

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

sqlmesh/core/plan/explainer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ def visit_after_all_stage(self, stage: stages.AfterAllStage) -> Tree:
9090
return Tree("[bold]Execute after all statements[/bold]")
9191

9292
def visit_physical_layer_update_stage(self, stage: stages.PhysicalLayerUpdateStage) -> Tree:
93-
if not stage.snapshots:
93+
snapshots = [
94+
s for s in stage.snapshots if s.snapshot_id in stage.snapshots_with_missing_intervals
95+
]
96+
if not snapshots:
9497
return Tree("[bold]SKIP: No physical layer updates to perform[/bold]")
9598

9699
tree = Tree(
97100
"[bold]Validate SQL and create physical layer tables and views if they do not exist[/bold]"
98101
)
99-
for snapshot in stage.snapshots:
100-
if snapshot.snapshot_id not in stage.snapshots_with_missing_intervals:
101-
continue
102-
102+
for snapshot in snapshots:
103103
is_deployable = (
104104
stage.deployability_index.is_deployable(snapshot)
105105
if self.environment_naming_info.name != c.PROD

sqlmesh/core/plan/stages.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from sqlmesh.core.snapshot.definition import (
99
DeployabilityIndex,
1010
Snapshot,
11+
SnapshotChangeCategory,
1112
SnapshotTableInfo,
1213
SnapshotId,
1314
Interval,
@@ -255,7 +256,13 @@ def build(self, plan: EvaluatablePlan) -> t.List[PlanStage]:
255256
if s.is_paused
256257
and s.is_model
257258
and not s.is_symbolic
258-
and (not deployability_index_for_creation.is_representative(s) or s.is_view)
259+
and (
260+
not deployability_index_for_creation.is_representative(s)
261+
or (
262+
s.is_view
263+
and s.change_category == SnapshotChangeCategory.INDIRECT_NON_BREAKING
264+
)
265+
)
259266
]
260267

261268
snapshots_to_intervals = self._missing_intervals(

0 commit comments

Comments
 (0)