Skip to content

Commit 49f648b

Browse files
authored
fix: migration 0063 loads subset of data (#3681)
1 parent ae5ba7f commit 49f648b

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

sqlmesh/migrations/v0063_change_signals.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def migrate(state_sync, **kwargs): # type: ignore
1818

1919
new_snapshots = []
2020

21+
signal_change = False
2122
for (
2223
name,
2324
identifier,
@@ -47,6 +48,7 @@ def migrate(state_sync, **kwargs): # type: ignore
4748
signals = node.get("signals")
4849

4950
if signals:
51+
signal_change = True
5052
node["signals"] = []
5153

5254
for signal in signals:
@@ -60,21 +62,21 @@ def migrate(state_sync, **kwargs): # type: ignore
6062
)
6163
)
6264

63-
new_snapshots.append(
64-
{
65-
"name": name,
66-
"identifier": identifier,
67-
"version": version,
68-
"snapshot": json.dumps(parsed_snapshot),
69-
"kind_name": kind_name,
70-
"updated_ts": updated_ts,
71-
"unpaused_ts": unpaused_ts,
72-
"ttl_ms": ttl_ms,
73-
"unrestorable": unrestorable,
74-
}
75-
)
65+
new_snapshots.append(
66+
{
67+
"name": name,
68+
"identifier": identifier,
69+
"version": version,
70+
"snapshot": json.dumps(parsed_snapshot),
71+
"kind_name": kind_name,
72+
"updated_ts": updated_ts,
73+
"unpaused_ts": unpaused_ts,
74+
"ttl_ms": ttl_ms,
75+
"unrestorable": unrestorable,
76+
}
77+
)
7678

77-
if new_snapshots:
79+
if signal_change and new_snapshots:
7880
engine_adapter.delete_from(snapshots_table, "TRUE")
7981
blob_type = blob_text_type(engine_adapter.dialect)
8082

0 commit comments

Comments
 (0)