Skip to content

Commit e33b65b

Browse files
authored
fix: respect disable restate dev unpaused snapshots (#3840)
1 parent a91ddd5 commit e33b65b

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

sqlmesh/core/plan/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def is_restateable_snapshot(snapshot: Snapshot) -> bool:
329329
if not snapshot:
330330
raise PlanError(f"Cannot restate model '{model_fqn}'. Model does not exist.")
331331
if not forward_only_preview_needed:
332-
if not self._is_dev and snapshot.disable_restatement:
332+
if (not self._is_dev or not snapshot.is_paused) and snapshot.disable_restatement:
333333
# This is a warning but we print this as error since the Console is lacking API for warnings.
334334
self._console.log_error(
335335
f"Cannot restate model '{model_fqn}'. "

tests/core/test_plan.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,12 @@ def test_disable_restatement(make_snapshot, mocker: MockerFixture):
18531853
snapshot.snapshot_id: (to_timestamp(plan.start), to_timestamp(to_date("today")))
18541854
}
18551855

1856+
# We don't want to restate a disable_restatement model if it is unpaused since that would be mean we are violating
1857+
# the model kind property
1858+
snapshot.unpaused_ts = 9999999999
1859+
plan = PlanBuilder(context_diff, schema_differ, is_dev=True, restate_models=['"a"']).build()
1860+
assert plan.restatements == {}
1861+
18561862

18571863
def test_revert_to_previous_value(make_snapshot, mocker: MockerFixture):
18581864
"""

0 commit comments

Comments
 (0)