Skip to content

Commit 49f7d11

Browse files
committed
Fix: Improve the condition under which sqlmesh raises an error about snapshot being unrevertable (#1879)
1 parent 3b24f04 commit 49f7d11

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sqlmesh/core/plan/definition.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ def _ensure_no_forward_only_revert(self) -> None:
666666
if (
667667
candidate.snapshot_id not in self.context_diff.new_snapshots
668668
and promoted.is_forward_only
669+
and not promoted.is_paused
669670
and not candidate.is_forward_only
670671
and not candidate.is_indirect_non_breaking
671672
and (

tests/core/test_plan.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
SnapshotFingerprint,
1717
)
1818
from sqlmesh.utils.dag import DAG
19-
from sqlmesh.utils.date import now, to_date, to_datetime, to_timestamp, yesterday_ds
19+
from sqlmesh.utils.date import (
20+
now,
21+
now_timestamp,
22+
to_date,
23+
to_datetime,
24+
to_timestamp,
25+
yesterday_ds,
26+
)
2027
from sqlmesh.utils.errors import PlanError
2128

2229

@@ -263,6 +270,7 @@ def test_forward_only_revert_not_allowed(make_snapshot, mocker: MockerFixture):
263270
forward_only_snapshot = make_snapshot(SqlModel(name="a", query=parse_one("select 2, ds")))
264271
forward_only_snapshot.categorize_as(SnapshotChangeCategory.FORWARD_ONLY)
265272
forward_only_snapshot.version = snapshot.version
273+
forward_only_snapshot.unpaused_ts = now_timestamp()
266274
assert forward_only_snapshot.is_forward_only
267275

268276
context_diff_mock = mocker.Mock()

0 commit comments

Comments
 (0)