Skip to content

Commit

Permalink
move requirements loading to load
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Oct 30, 2024
1 parent 7fe4804 commit dd3c0b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sqlmesh/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def __init__(
loader=(loader or config.loader)(**config.loader_kwargs), configs={}
)
self._loaders[project_type].configs[path] = config
self._load_requirements(path)

self.project_type = c.HYBRID if len(self._loaders) > 1 else project_type
self._all_dialects: t.Set[str] = {self.config.dialect or ""}
Expand Down Expand Up @@ -536,7 +535,10 @@ def load(self, update_schemas: bool = True) -> GenericContext[C]:
load_start_ts = time.perf_counter()

projects = []
self._requirements.clear()
for context_loader in self._loaders.values():
for path in context_loader.configs:
self._load_requirements(path)
with sys_path(*context_loader.configs):
projects.append(context_loader.loader.load(self, update_schemas))

Expand Down Expand Up @@ -2141,7 +2143,7 @@ def _load_requirements(self, path: Path) -> None:
other_ver = self._requirements.get(dep, ver)
if ver != other_ver:
raise SQLMeshError(
"Conflicting requirement {dep}: {ver} != {other_ver}. Fix your sqlmesh.lock file."
f"Conflicting requirement {dep}: {ver} != {other_ver}. Fix your {c.REQUIREMENTS} file."
)
self._requirements[dep] = ver

Expand Down

0 comments on commit dd3c0b0

Please sign in to comment.