Skip to content

Commit 0d926ab

Browse files
committed
PR feedback
1 parent 168ec9a commit 0d926ab

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

sqlmesh/core/plan/builder.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,12 +712,6 @@ def _categorize_snapshot(
712712
snapshot.categorize_as(SnapshotChangeCategory.INDIRECT_NON_BREAKING, forward_only)
713713
else:
714714
# Metadata updated.
715-
if not forward_only and snapshot.is_seed:
716-
# seeds with metadata updates should be categorized as forward_only to prevent unnecessary backfill
717-
# backfill should only happen if the actual seed data changes, in which case it will be classed as
718-
# directly modified / breaking and not forward only as this code path will not be hit
719-
forward_only = True
720-
721715
snapshot.categorize_as(SnapshotChangeCategory.METADATA, forward_only)
722716

723717
def _get_orphaned_indirect_change_category(

tests/core/test_integration.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10664,15 +10664,15 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
1066410664
set_console(orig_console)
1066510665

1066610666

10667-
def test_seed_model_metadata_update_sets_forward_only(tmp_path: Path):
10667+
def test_seed_model_metadata_update_does_not_trigger_backfill(tmp_path: Path):
1066810668
"""
1066910669
Scenario:
1067010670
- Create a seed model; perform initial population
1067110671
- Modify the model with a metadata-only change and trigger a plan
1067210672
1067310673
Outcome:
1067410674
- The seed model is modified (metadata-only) but this should NOT trigger backfill
10675-
- To prevent backfill, the categorizer needs to set forward_only on the seed
10675+
- There should be no missing_intervals on the plan to backfill
1067610676
"""
1067710677

1067810678
models_path = tmp_path / "models"
@@ -10703,7 +10703,6 @@ def test_seed_model_metadata_update_sets_forward_only(tmp_path: Path):
1070310703
plan = ctx.plan(auto_apply=True)
1070410704

1070510705
original_seed_snapshot = ctx.snapshots['"memory"."test"."source_data"']
10706-
assert not original_seed_snapshot.forward_only
1070710706
assert plan.directly_modified == {original_seed_snapshot.snapshot_id}
1070810707
assert plan.metadata_updated == set()
1070910708
assert plan.missing_intervals
@@ -10735,9 +10734,6 @@ def test_seed_model_metadata_update_sets_forward_only(tmp_path: Path):
1073510734
assert plan.has_changes
1073610735

1073710736
new_seed_snapshot = ctx.snapshots['"memory"."test"."source_data"']
10738-
assert (
10739-
new_seed_snapshot.forward_only
10740-
) # change needs to be applied as forward-only to prevent backfill
1074110737
assert (
1074210738
new_seed_snapshot.version == original_seed_snapshot.version
1074310739
) # should be using the same physical table

tests/core/test_plan.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ def test_forward_only_plan_seed_models(make_snapshot, mocker: MockerFixture):
11891189
assert not snapshot_a_updated.is_forward_only
11901190

11911191

1192-
def test_seed_model_metadata_change_categorized_forward_only(
1192+
def test_seed_model_metadata_change_no_missing_intervals(
11931193
make_snapshot: t.Callable[..., Snapshot],
11941194
):
11951195
snapshot_a = make_snapshot(
@@ -1241,13 +1241,11 @@ def test_seed_model_metadata_change_categorized_forward_only(
12411241

12421242
plan = PlanBuilder(context_diff).build()
12431243
assert snapshot_a_metadata_updated.change_category == SnapshotChangeCategory.METADATA
1244-
assert (
1245-
snapshot_a_metadata_updated.is_forward_only
1246-
) # needs to be forward_only to prevent backfill on a metadata change
1244+
assert not snapshot_a_metadata_updated.is_forward_only
1245+
assert not plan.missing_intervals # plan should have no missing intervals
12471246
assert (
12481247
snapshot_a_metadata_updated.intervals == snapshot_a.intervals
12491248
) # intervals should have been copied
1250-
assert not plan.missing_intervals # plan should have no missing intervals
12511249

12521250

12531251
def test_start_inference(make_snapshot, mocker: MockerFixture):

0 commit comments

Comments
 (0)