Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all schemas to fall back to a string value #25

Merged
merged 4 commits into from
Feb 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions tap_google_sheets/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,7 @@ 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': 'number', 'multipleOf': 1e-15}
column_gs_type = 'numberType'
# Catch-all to deal with other types and set to string
# column_effective_value_type: formulaValue, errorValue, or other
Expand Down Expand Up @@ -205,6 +192,14 @@ def get_sheet_schema_columns(sheet):
}
columns.append(column)

if column_gs_type in {'numberType.DATE_TIME', 'numberType.DATE', 'numberType.TIME', 'numberType'}:
col_properties = {
'anyOf': [
col_properties,
{'type': ['null', 'string']}
]
}

sheet_json_schema['properties'][column_name] = col_properties

prior_header = column_name
Expand Down