Skip to content

Commit b256ba5

Browse files
authored
Fix: Propagation of snapshots with missing intervals into the physical layer update stage (#4801)
1 parent 186f0ed commit b256ba5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sqlmesh/core/plan/stages.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ def _get_physical_layer_update_stage(
431431
return PhysicalLayerUpdateStage(
432432
snapshots=self._get_snapshots_to_create(plan, snapshots),
433433
all_snapshots=snapshots,
434-
snapshots_with_missing_intervals={s.snapshot_id for s in snapshots_to_intervals},
434+
snapshots_with_missing_intervals={
435+
s.snapshot_id
436+
for s in snapshots_to_intervals
437+
if plan.is_selected_for_backfill(s.name)
438+
},
435439
deployability_index=deployability_index,
436440
)
437441

tests/core/test_plan_stages.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def test_build_plan_stages_basic(
141141
snapshot_a.snapshot_id,
142142
snapshot_b.snapshot_id,
143143
}
144+
assert {s.snapshot_id for s in physical_stage.snapshots_with_missing_intervals} == {
145+
snapshot_a.snapshot_id,
146+
snapshot_b.snapshot_id,
147+
}
144148
assert physical_stage.deployability_index == DeployabilityIndex.all_deployable()
145149

146150
# Verify BackfillStage
@@ -357,6 +361,7 @@ def test_build_plan_stages_select_models(
357361
assert len(physical_stage.snapshots) == 1
358362
assert {s.snapshot_id for s in physical_stage.snapshots} == {snapshot_a.snapshot_id}
359363
assert physical_stage.deployability_index == DeployabilityIndex.all_deployable()
364+
assert physical_stage.snapshots_with_missing_intervals == {snapshot_a.snapshot_id}
360365

361366
# Verify BackfillStage
362367
backfill_stage = stages[2]

0 commit comments

Comments
 (0)