Skip to content

Commit bf770f8

Browse files
committed
address comments
1 parent 87f3da4 commit bf770f8

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

sqlmesh/core/state_sync/db/environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def finalize(self, environment: Environment) -> None:
152152
stored_plan_id = stored_plan_id_row[0]
153153
if stored_plan_id != environment.plan_id:
154154
raise SQLMeshError(
155-
f"Another plan ({stored_plan_id}) was applied to the target environment '{environment.name}' while the current plan "
156-
f"({environment.plan_id}) was still in progress. Please re-apply your plan to resolve this error."
155+
f"Another plan ({stored_plan_id}) was applied to the target environment '{environment.name}' while your current plan "
156+
f"({environment.plan_id}) was still in progress, interrupting it. Please re-apply your plan to resolve this error."
157157
)
158158

159159
environment.finalized_ts = now_timestamp()

sqlmesh/core/state_sync/db/facade.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ def promote(
205205
if not existing_environment.expired:
206206
if environment.previous_plan_id != existing_environment.plan_id:
207207
raise ConflictingPlanError(
208-
f"Another plan ({existing_environment.plan_id}) was applied to the target environment '{environment.name}' while the current plan "
209-
f"({environment.plan_id}) was still in progress. Please re-apply your plan to resolve this error."
208+
f"Another plan ({existing_environment.plan_id}) was applied to the target environment '{environment.name}' while your current plan "
209+
f"({environment.plan_id}) was still in progress, interrupting it. Please re-apply your plan to resolve this error."
210210
)
211211
if no_gaps_snapshot_names != set():
212212
snapshots = self.get_snapshots(environment.snapshots).values()
@@ -613,7 +613,8 @@ def _ensure_no_gaps(
613613

614614
if missing_intervals:
615615
raise SQLMeshError(
616-
f"Detected gaps in snapshot {target_snapshot.snapshot_id}: {missing_intervals}"
616+
f"Detected missing intervals for model {target_snapshot.name}, interrupting the current plan. "
617+
"Please re-apply your plan to resolve this error."
617618
)
618619

619620
@contextlib.contextmanager

tests/core/state_sync/test_state_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ def test_promote_snapshots_parent_plan_id_mismatch(
861861
with pytest.raises(
862862
SQLMeshError,
863863
match=re.escape(
864-
"Another plan (new_plan_id) was applied to the target environment 'prod' while the current plan (stale_new_plan_id) was still in progress. Please re-apply your plan to resolve this error."
864+
"Another plan (new_plan_id) was applied to the target environment 'prod' while your current plan (stale_new_plan_id) was still in progress, interrupting it. Please re-apply your plan to resolve this error."
865865
),
866866
):
867867
state_sync.promote(stale_new_environment)
@@ -949,7 +949,7 @@ def test_promote_snapshots_no_gaps(state_sync: EngineAdapterStateSync, make_snap
949949
state_sync.add_interval(new_snapshot_missing_interval, "2022-01-01", "2022-01-02")
950950
with pytest.raises(
951951
SQLMeshError,
952-
match=r"Detected gaps in snapshot.*",
952+
match=r'Detected missing intervals for model "a", interrupting the current plan. Please re-apply your plan to resolve this error.',
953953
):
954954
promote_snapshots(state_sync, [new_snapshot_missing_interval], "prod", no_gaps=True)
955955

@@ -1026,7 +1026,7 @@ def test_finalize(state_sync: EngineAdapterStateSync, make_snapshot: t.Callable)
10261026
with pytest.raises(
10271027
SQLMeshError,
10281028
match=re.escape(
1029-
"Another plan (test_plan_id) was applied to the target environment 'prod' while the current plan (different_plan_id) was still in progress. Please re-apply your plan to resolve this error."
1029+
"Another plan (test_plan_id) was applied to the target environment 'prod' while your current plan (different_plan_id) was still in progress, interrupting it. Please re-apply your plan to resolve this error."
10301030
),
10311031
):
10321032
state_sync.finalize(env)
@@ -1061,7 +1061,7 @@ def test_start_date_gap(state_sync: EngineAdapterStateSync, make_snapshot: t.Cal
10611061
state_sync.add_interval(snapshot, "2022-01-03", "2022-01-04")
10621062
with pytest.raises(
10631063
SQLMeshError,
1064-
match=r"Detected gaps in snapshot.*",
1064+
match=r'Detected missing intervals for model "a", interrupting the current plan. Please re-apply your plan to resolve this error.',
10651065
):
10661066
promote_snapshots(state_sync, [snapshot], "prod", no_gaps=True)
10671067

0 commit comments

Comments
 (0)