diff options
Diffstat (limited to 'tap_google_sheets/schema.py')
-rw-r--r-- | tap_google_sheets/schema.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tap_google_sheets/schema.py b/tap_google_sheets/schema.py index fcaccf9..13e595a 100644 --- a/tap_google_sheets/schema.py +++ b/tap_google_sheets/schema.py | |||
@@ -152,20 +152,7 @@ def get_sheet_schema_columns(sheet): | |||
152 | else: | 152 | else: |
153 | # Interesting - order in the anyOf makes a difference. | 153 | # Interesting - order in the anyOf makes a difference. |
154 | # Number w/ multipleOf must be listed last, otherwise errors occur. | 154 | # Number w/ multipleOf must be listed last, otherwise errors occur. |
155 | col_properties = { | 155 | col_properties = {'type': 'number', 'multipleOf': 1e-15} |
156 | 'anyOf': [ | ||
157 | { | ||
158 | 'type': 'null' | ||
159 | }, | ||
160 | { | ||
161 | 'type': 'number', | ||
162 | 'multipleOf': 1e-15 | ||
163 | }, | ||
164 | { | ||
165 | 'type': 'string' | ||
166 | } | ||
167 | ] | ||
168 | } | ||
169 | column_gs_type = 'numberType' | 156 | column_gs_type = 'numberType' |
170 | # Catch-all to deal with other types and set to string | 157 | # Catch-all to deal with other types and set to string |
171 | # column_effective_value_type: formulaValue, errorValue, or other | 158 | # column_effective_value_type: formulaValue, errorValue, or other |
@@ -205,6 +192,14 @@ def get_sheet_schema_columns(sheet): | |||
205 | } | 192 | } |
206 | columns.append(column) | 193 | columns.append(column) |
207 | 194 | ||
195 | if column_gs_type in {'numberType.DATE_TIME', 'numberType.DATE', 'numberType.TIME', 'numberType'}: | ||
196 | col_properties = { | ||
197 | 'anyOf': [ | ||
198 | col_properties, | ||
199 | {'type': ['null', 'string']} | ||
200 | ] | ||
201 | } | ||
202 | |||
208 | sheet_json_schema['properties'][column_name] = col_properties | 203 | sheet_json_schema['properties'][column_name] = col_properties |
209 | 204 | ||
210 | prior_header = column_name | 205 | prior_header = column_name |