Skip to content

Commit

Permalink
account for sources being None
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Apr 30, 2024
1 parent 2d29fb1 commit e67517b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@
# ===============================================================================


def yaml_from_file(source_file: SchemaSourceFile) -> Dict[str, Any]:
def yaml_from_file(source_file: SchemaSourceFile) -> Optional[Dict[str, Any]]:
"""If loading the yaml fails, raise an exception."""
try:
# source_file.contents can sometimes be None
contents = load_yaml_text(source_file.contents or "", source_file.path)

if contents is None:
return contents

Check warning on line 121 in core/dbt/parser/schemas.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/parser/schemas.py#L121

Added line #L121 was not covered by tests

# When loaded_loaded_at_field is defined as None or null, it shows up in
# the dict but when it is not defined, it does not show up in the dict
# We need to capture this to be able to override source level settings later.
Expand Down

0 comments on commit e67517b

Please sign in to comment.