Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Don't expand intervals when recording an empty backfill #4031

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sqlmesh/core/plan/evaluator.py
Original file line number Diff line number Diff line change
@@ -197,7 +197,9 @@ def _backfill(
if plan.empty_backfill:
intervals_to_add = []
for snapshot in snapshots_by_name.values():
intervals = [snapshot.inclusive_exclusive(plan.start, plan.end, strict=False)]
intervals = [
snapshot.inclusive_exclusive(plan.start, plan.end, strict=False, expand=False)
]
is_deployable = deployability_index.is_deployable(snapshot)
intervals_to_add.append(
SnapshotIntervals(
6 changes: 5 additions & 1 deletion tests/core/test_integration.py
Original file line number Diff line number Diff line change
@@ -3874,7 +3874,7 @@ def test_create_environment_no_changes_with_selector(init_and_plan_context: t.Ca


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

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):
assert not plan.has_changes
assert not plan.missing_intervals

snapshots = plan.snapshots
for snapshot in snapshots.values():
assert snapshot.intervals[-1][1] <= to_timestamp("2023-01-08")


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