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

Change dict to json #1028

Merged
merged 8 commits into from
Jul 11, 2024
10 changes: 8 additions & 2 deletions parsons/google/google_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"datetime": "DATETIME",
"date": "DATE",
"time": "TIME",
"dict": "RECORD",
"NoneType": "STRING",
"UUID": "STRING",
"timestamp": "TIMESTAMP",
Expand Down Expand Up @@ -1200,7 +1199,14 @@ def _generate_schema_from_parsons_table(self, tbl):
if isinstance(value, datetime.datetime) and value.tzinfo:
best_type = "timestamp"

field_type = self._bigquery_type(best_type)
try:
field_type = self._bigquery_type(best_type)
except KeyError as e:
raise KeyError(
"Column type not supported for load to BigQuery. "
"Consider converting to another type. "
f"[type={best_type}]"
) from e
field = bigquery.schema.SchemaField(stat["name"], field_type)
fields.append(field)
return fields
Expand Down
Loading