Skip to content

Commit f9ad555

Browse files
authored
Fix: Only push new records when migrating snapshot rows (#1927)
1 parent 42edd22 commit f9ad555

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sqlmesh/core/state_sync/engine_adapter.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,12 @@ def map_data_versions(
933933
for name, versions in from_snapshot.indirect_versions.items()
934934
}
935935

936-
self._push_snapshots(new_snapshots.values(), overwrite=True)
936+
existing_new_snapshots = self.snapshots_exist(new_snapshots)
937+
new_snapshots_to_push = [
938+
s for s in new_snapshots.values() if s.snapshot_id not in existing_new_snapshots
939+
]
940+
if new_snapshots_to_push:
941+
self._push_snapshots(new_snapshots_to_push)
937942

938943
updated_prod_environment: t.Optional[Environment] = None
939944
updated_environments = []

0 commit comments

Comments
 (0)