From c52488441229cda5acd17b911e922e25e7469604 Mon Sep 17 00:00:00 2001 From: slawekrewaj Date: Tue, 17 Sep 2019 15:55:38 +0200 Subject: [PATCH] Supporting schema arrays definig type of the item as list, instead of a simple value, for example "type": ["null", "integer"] This format is supported in normal fields and objects. We just miss it in arrays --- target_bigquery.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target_bigquery.py b/target_bigquery.py index 111d11f..112f36c 100644 --- a/target_bigquery.py +++ b/target_bigquery.py @@ -78,6 +78,8 @@ def define_schema(field, name): schema_fields = tuple(build_schema(field)) if schema_type == "array": schema_type = field.get('items').get('type') + if isinstance(schema_type, list): + schema_type = schema_type[-1] schema_mode = "REPEATED" if schema_type == "object": schema_type = "RECORD"