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
10 changes: 6 additions & 4 deletions sqlmesh/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ def refresh(self) -> None:
if self._loader.reload_needed():
self.load()

def load(self) -> Context:
def load(self, update_schemas: bool = True) -> Context:
"""Load all files in the context's path."""
with sys_path(*self.configs):
project = self._loader.load(self)
project = self._loader.load(self, update_schemas)
self._hooks = project.hooks
self._macros = project.macros
self._models = project.models
Expand Down Expand Up @@ -844,13 +844,15 @@ def create_external_models(self) -> None:
The schema file contains all columns and types of external models, allowing for more robust
lineage, validation, and optimizations.
"""
models = self._models or self._loader.load(self, update_schemas=False).models
if not self._models:
self.load(update_schemas=False)

for path, config in self.configs.items():
create_schema_file(
path=path / c.SCHEMA_YAML,
models={
name: model
for name, model in models.items()
for name, model in self._models.items()
if self.config_for_model(model) is config
},
adapter=self._engine_adapter,
Expand Down