From a38c75de8cade1e94cf6528c1cb148451089b187 Mon Sep 17 00:00:00 2001 From: nickymikail Date: Wed, 24 Oct 2018 15:22:22 -0700 Subject: [PATCH] fix define_schema for arrays of records --- target_bigquery.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target_bigquery.py b/target_bigquery.py index 4b9fdd1..d4fb944 100644 --- a/target_bigquery.py +++ b/target_bigquery.py @@ -73,12 +73,16 @@ def define_schema(field, name): schema_type = field['type'][1] else: schema_type = field['type'] - if schema_type == "array": - schema_type = field.get('items').get('type') - schema_mode = "REPEATED" if schema_type == "object": schema_type = "RECORD" schema_fields = tuple(build_schema(field)) + if schema_type == "array": + schema_type = field.get('items').get('type') + schema_mode = "REPEATED" + if schema_type == "object": + schema_type = "RECORD" + schema_fields = tuple(build_schema(field.get('items'))) + if schema_type == "string": if "format" in field: