Skip to content

Commit 70ddf0c

Browse files
eakmanrqizeigerman
authored andcommitted
fix: respect disable restate dev unpaused snapshots (#3840)
1 parent 56990fe commit 70ddf0c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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
@@ -1846,6 +1846,12 @@ def test_disable_restatement(make_snapshot, mocker: MockerFixture):
18461846
snapshot.snapshot_id: (to_timestamp(plan.start), to_timestamp(to_date("today")))
18471847
}
18481848

1849+
# We don't want to restate a disable_restatement model if it is unpaused since that would be mean we are violating
1850+
# the model kind property
1851+
snapshot.unpaused_ts = 9999999999
1852+
plan = PlanBuilder(context_diff, schema_differ, is_dev=True, restate_models=['"a"']).build()
1853+
assert plan.restatements == {}
1854+
18491855

18501856
def test_revert_to_previous_value(make_snapshot, mocker: MockerFixture):
18511857
"""

0 commit comments

Comments
 (0)