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
6 changes: 5 additions & 1 deletion sqlmesh/core/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ def _load_external_models(
def _load(path: Path) -> t.List[Model]:
try:
with open(path, "r", encoding="utf-8") as file:
yaml = YAML().load(file)
# Allow empty YAML files to return an empty list
if yaml is None:
return []
return [
create_external_model(
defaults=self.config.model_defaults.dict(),
Expand All @@ -346,7 +350,7 @@ def _load(path: Path) -> t.List[Model]:
**row,
},
)
for row in YAML().load(file.read())
for row in yaml
]
except Exception as ex:
raise ConfigError(self._failed_to_load_model_error(path, ex), path)
Expand Down
Loading