From f978909a2207512e378fdece3017756e6ed8a56d Mon Sep 17 00:00:00 2001 From: Chris Ulicny Date: Mon, 16 Nov 2020 10:39:44 -0500 Subject: [PATCH 1/3] Updated schema generation to handle number format and be pipelinewise compatible: From https://github.com/singer-io/tap-google-sheets/pull/19 --- tap_google_sheets/schema.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/tap_google_sheets/schema.py b/tap_google_sheets/schema.py index fcaccf9..3887c12 100644 --- a/tap_google_sheets/schema.py +++ b/tap_google_sheets/schema.py @@ -149,22 +149,15 @@ def get_sheet_schema_columns(sheet): elif column_number_format_type == 'TEXT': col_properties = {'type': ['null', 'string']} column_gs_type = 'stringValue' + elif column_number_format_type == 'NUMBER': + col_properties = {'type': ['null', 'number']} + column_gs_type = 'numberType' else: # Interesting - order in the anyOf makes a difference. # Number w/ multipleOf must be listed last, otherwise errors occur. col_properties = { - 'anyOf': [ - { - 'type': 'null' - }, - { - 'type': 'number', - 'multipleOf': 1e-15 - }, - { - 'type': 'string' - } - ] + 'type': ['null', 'number', 'string'], + 'multipleOf': 1e-15 } column_gs_type = 'numberType' # Catch-all to deal with other types and set to string From 6a7b719133c9b4898836ac483fdf4f1cafea7a73 Mon Sep 17 00:00:00 2001 From: Chris Ulicny Date: Mon, 16 Nov 2020 11:49:38 -0500 Subject: [PATCH 2/3] Reverted anyOf to array change as its unnecessary --- tap_google_sheets/schema.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tap_google_sheets/schema.py b/tap_google_sheets/schema.py index 3887c12..9904d4c 100644 --- a/tap_google_sheets/schema.py +++ b/tap_google_sheets/schema.py @@ -155,9 +155,19 @@ def get_sheet_schema_columns(sheet): else: # Interesting - order in the anyOf makes a difference. # Number w/ multipleOf must be listed last, otherwise errors occur. - col_properties = { - 'type': ['null', 'number', 'string'], - 'multipleOf': 1e-15 + col_properties = { + 'anyOf': [ + { + 'type': 'null' + }, + { + 'type': 'number', + 'multipleOf': 1e-15 + }, + { + 'type': 'string' + } + ] } column_gs_type = 'numberType' # Catch-all to deal with other types and set to string From deb592f3662d8ebe4c3a1800b9c584cff5c3c30a Mon Sep 17 00:00:00 2001 From: Chris Ulicny Date: Mon, 16 Nov 2020 17:41:14 -0500 Subject: [PATCH 3/3] Revert "Reverted anyOf to array change as its unnecessary" This reverts commit 6a7b719133c9b4898836ac483fdf4f1cafea7a73. --- tap_google_sheets/schema.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tap_google_sheets/schema.py b/tap_google_sheets/schema.py index 9904d4c..3887c12 100644 --- a/tap_google_sheets/schema.py +++ b/tap_google_sheets/schema.py @@ -155,19 +155,9 @@ def get_sheet_schema_columns(sheet): else: # Interesting - order in the anyOf makes a difference. # Number w/ multipleOf must be listed last, otherwise errors occur. - col_properties = { - 'anyOf': [ - { - 'type': 'null' - }, - { - 'type': 'number', - 'multipleOf': 1e-15 - }, - { - 'type': 'string' - } - ] + col_properties = { + 'type': ['null', 'number', 'string'], + 'multipleOf': 1e-15 } column_gs_type = 'numberType' # Catch-all to deal with other types and set to string