diff --git a/sqlmesh/core/plan/explainer.py b/sqlmesh/core/plan/explainer.py index aa1d5775b4..75aa0966ff 100644 --- a/sqlmesh/core/plan/explainer.py +++ b/sqlmesh/core/plan/explainer.py @@ -90,16 +90,16 @@ def visit_after_all_stage(self, stage: stages.AfterAllStage) -> Tree: return Tree("[bold]Execute after all statements[/bold]") def visit_physical_layer_update_stage(self, stage: stages.PhysicalLayerUpdateStage) -> Tree: - if not stage.snapshots: + snapshots = [ + s for s in stage.snapshots if s.snapshot_id in stage.snapshots_with_missing_intervals + ] + if not snapshots: return Tree("[bold]SKIP: No physical layer updates to perform[/bold]") tree = Tree( "[bold]Validate SQL and create physical layer tables and views if they do not exist[/bold]" ) - for snapshot in stage.snapshots: - if snapshot.snapshot_id not in stage.snapshots_with_missing_intervals: - continue - + for snapshot in snapshots: is_deployable = ( stage.deployability_index.is_deployable(snapshot) if self.environment_naming_info.name != c.PROD diff --git a/sqlmesh/core/plan/stages.py b/sqlmesh/core/plan/stages.py index d8c7cba85d..b50edfbb01 100644 --- a/sqlmesh/core/plan/stages.py +++ b/sqlmesh/core/plan/stages.py @@ -8,6 +8,7 @@ from sqlmesh.core.snapshot.definition import ( DeployabilityIndex, Snapshot, + SnapshotChangeCategory, SnapshotTableInfo, SnapshotId, Interval, @@ -255,7 +256,13 @@ def build(self, plan: EvaluatablePlan) -> t.List[PlanStage]: if s.is_paused and s.is_model and not s.is_symbolic - and (not deployability_index_for_creation.is_representative(s) or s.is_view) + and ( + not deployability_index_for_creation.is_representative(s) + or ( + s.is_view + and s.change_category == SnapshotChangeCategory.INDIRECT_NON_BREAKING + ) + ) ] snapshots_to_intervals = self._missing_intervals(