Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sqlmesh/core/plan/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,13 @@ def _restatement_intervals_across_all_environments(

snapshots_to_restate: t.Dict[SnapshotId, t.Tuple[SnapshotTableInfo, Interval]] = {}

for env in self.state_sync.get_environments():
for env_summary in self.state_sync.get_environments_summary():
# Fetch the full environment object one at a time to avoid loading all environments into memory at once
env = self.state_sync.get_environment(env_summary.name)
if not env:
logger.warning("Environment %s not found", env_summary.name)
continue

keyed_snapshots = {s.name: s.table_info for s in env.snapshots}

# We dont just restate matching snapshots, we also have to restate anything downstream of them
Expand Down