Skip to content

Commit 9d74e7a

Browse files
authored
Chore: Change snapshot_evaluator in Context to a property (#1583)
1 parent abef584 commit 9d74e7a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

sqlmesh/core/context.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,7 @@ def __init__(
279279
test_connection_config = self.config.get_test_connection(self.gateway)
280280
self._test_engine_adapter = test_connection_config.create_engine_adapter()
281281

282-
self.snapshot_evaluator = SnapshotEvaluator(
283-
self.engine_adapter,
284-
ddl_concurrent_tasks=self.concurrent_tasks,
285-
console=self.console,
286-
)
282+
self._snapshot_evaluator: t.Optional[SnapshotEvaluator] = None
287283

288284
self._provided_state_sync: t.Optional[StateSync] = state_sync
289285
self._state_sync: t.Optional[StateSync] = None
@@ -304,6 +300,16 @@ def engine_adapter(self) -> EngineAdapter:
304300
"""Returns an engine adapter."""
305301
return self._engine_adapter
306302

303+
@property
304+
def snapshot_evaluator(self) -> SnapshotEvaluator:
305+
if not self._snapshot_evaluator:
306+
self._snapshot_evaluator = SnapshotEvaluator(
307+
self.engine_adapter,
308+
ddl_concurrent_tasks=self.concurrent_tasks,
309+
console=self.console,
310+
)
311+
return self._snapshot_evaluator
312+
307313
def execution_context(self, is_dev: bool = False) -> ExecutionContext:
308314
"""Returns an execution context."""
309315
return ExecutionContext(

0 commit comments

Comments
 (0)