From 52f6d2b8e78bee28f6546d5395e331bb1766e268 Mon Sep 17 00:00:00 2001 From: Gabrielle Tam Date: Fri, 29 Dec 2023 10:11:54 -0800 Subject: [PATCH 1/2] use .get method with default vs bracket location --- target_s3_parquet/data_type_generator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target_s3_parquet/data_type_generator.py b/target_s3_parquet/data_type_generator.py index f7e035b..2892b8d 100644 --- a/target_s3_parquet/data_type_generator.py +++ b/target_s3_parquet/data_type_generator.py @@ -54,8 +54,10 @@ def generate_tap_schema(schema, level=0, only_string=False): continue if cleaned_type == "object": + if attributes.get("properties") is None: + print('type is object but no properties found for:', name) field_definitions[name] = build_struct_type( - attributes["properties"], new_level + attributes.get("properties", {}), new_level ) elif cleaned_type == "array": array_type = get_valid_types(attributes["items"]["type"]) From 6a366658ca8a50daeae3ce604dc2af0fdd383ba3 Mon Sep 17 00:00:00 2001 From: Gabrielle Tam Date: Fri, 29 Dec 2023 11:02:36 -0800 Subject: [PATCH 2/2] remove print statement --- target_s3_parquet/data_type_generator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/target_s3_parquet/data_type_generator.py b/target_s3_parquet/data_type_generator.py index 2892b8d..8dfc94c 100644 --- a/target_s3_parquet/data_type_generator.py +++ b/target_s3_parquet/data_type_generator.py @@ -54,8 +54,6 @@ def generate_tap_schema(schema, level=0, only_string=False): continue if cleaned_type == "object": - if attributes.get("properties") is None: - print('type is object but no properties found for:', name) field_definitions[name] = build_struct_type( attributes.get("properties", {}), new_level )