Skip to content

Commit c6e0d99

Browse files
authored
Fix: Do not hydrate snapshots with intervals when deleting expired snapshots (#1454)
1 parent 7ae3fa7 commit c6e0d99

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sqlmesh/core/state_sync/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def delete_expired_snapshots(self) -> t.List[Snapshot]:
181181
current_time = now()
182182

183183
snapshots_by_version = defaultdict(list)
184-
for s in self._get_snapshots().values():
184+
for s in self._get_snapshots(hydrate_intervals=False).values():
185185
snapshots_by_version[(s.name, s.version)].append(s)
186186

187187
promoted_snapshot_ids = {
@@ -305,13 +305,15 @@ def _get_snapshots(
305305
snapshot_ids: t.Optional[t.Iterable[SnapshotIdLike]] = None,
306306
lock_for_update: bool = False,
307307
hydrate_seeds: bool = False,
308+
hydrate_intervals: bool = True,
308309
) -> t.Dict[SnapshotId, Snapshot]:
309310
"""Fetches specified snapshots.
310311
311312
Args:
312313
snapshot_ids: The collection of IDs of snapshots to fetch
313314
lock_for_update: Lock the snapshot rows for future update
314315
hydrate_seeds: Whether to hydrate seed snapshots with the content.
316+
hydrate_intervals: Whether to hydrate result snapshots with intervals.
315317
316318
Returns:
317319
A dictionary of snapshot ids to snapshots for ones that could be found.

0 commit comments

Comments
 (0)