We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 854379d commit 036b75eCopy full SHA for 036b75e
sqlmesh/core/loader.py
@@ -334,6 +334,10 @@ def _load_external_models(
334
def _load(path: Path) -> t.List[Model]:
335
try:
336
with open(path, "r", encoding="utf-8") as file:
337
+ yaml = YAML().load(file)
338
+ # Allow empty YAML files to return an empty list
339
+ if yaml is None:
340
+ return []
341
return [
342
create_external_model(
343
defaults=self.config.model_defaults.dict(),
@@ -346,7 +350,7 @@ def _load(path: Path) -> t.List[Model]:
346
350
**row,
347
351
},
348
352
)
349
- for row in YAML().load(file.read())
353
+ for row in yaml
354
]
355
except Exception as ex:
356
raise ConfigError(self._failed_to_load_model_error(path, ex), path)
0 commit comments