From e67517bd0cc9fc43516387ba24184b6df1ea8aae Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Tue, 30 Apr 2024 14:52:15 -0500 Subject: [PATCH] account for sources being None --- core/dbt/parser/schemas.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/dbt/parser/schemas.py b/core/dbt/parser/schemas.py index 05daea91822..fa1cf1587a6 100644 --- a/core/dbt/parser/schemas.py +++ b/core/dbt/parser/schemas.py @@ -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 + # 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.