Skip to content

Commit 17da21c

Browse files
committed
Fix: Don't expand intervals when recording an empty backfill
1 parent 75b7270 commit 17da21c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

sqlmesh/core/plan/evaluator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def _backfill(
197197
if plan.empty_backfill:
198198
intervals_to_add = []
199199
for snapshot in snapshots_by_name.values():
200-
intervals = [snapshot.inclusive_exclusive(plan.start, plan.end, strict=False)]
200+
intervals = [
201+
snapshot.inclusive_exclusive(plan.start, plan.end, strict=False, expand=False)
202+
]
201203
is_deployable = deployability_index.is_deployable(snapshot)
202204
intervals_to_add.append(
203205
SnapshotIntervals(

tests/core/test_integration.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3874,7 +3874,7 @@ def test_create_environment_no_changes_with_selector(init_and_plan_context: t.Ca
38743874

38753875

38763876
@time_machine.travel("2023-01-08 15:00:00 UTC")
3877-
def test_empty_bacfkill(init_and_plan_context: t.Callable):
3877+
def test_empty_backfill(init_and_plan_context: t.Callable):
38783878
context, _ = init_and_plan_context("examples/sushi")
38793879

38803880
plan = context.plan_builder("prod", skip_tests=True, empty_backfill=True).build()
@@ -3895,6 +3895,10 @@ def test_empty_bacfkill(init_and_plan_context: t.Callable):
38953895
assert not plan.has_changes
38963896
assert not plan.missing_intervals
38973897

3898+
snapshots = plan.snapshots
3899+
for snapshot in snapshots.values():
3900+
assert snapshot.intervals[-1][1] <= to_timestamp("2023-01-08")
3901+
38983902

38993903
@time_machine.travel("2023-01-08 15:00:00 UTC")
39003904
def test_dbt_requirements(sushi_dbt_context: Context):

0 commit comments

Comments
 (0)