Description
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Is your feature request related to a problem? Please describe.
python-bigquery does not seem to currently support uploading dataframes where one of the columns in the destination table is JSON dtype.
Quick partial code example:
schema = [
bigquery.SchemaField("system_id", "STRING"),
bigquery.SchemaField("summery_type", "STRING"),
bigquery.SchemaField("summery_datetime", "DATETIME"),
bigquery.SchemaField("summery_is_good", "BOOL"),
bigquery.SchemaField("summery_data", "JSON"), #Stored in dataframe as JSON formatted string
]
job_config = bigquery.LoadJobConfig(schema=schema)
job = client.load_table_from_dataframe(data, table_obj, job_config=job_config)
print(job.result())
Result:
google.api_core.exceptions.BadRequest: 400 Unsupported field type: JSON; reason: invalid, message: Unsupported field type: JSON
Describe the solution you'd like
Implement support for loading data to BigQuery that contain JSON columns.
Additional context
$ conda list | grep bigquery
google-cloud-bigquery-core 3.25.0 pyhd8ed1ab_0
google-cloud-bigquery-storage 2.25.0 pyhca7485f_0
google-cloud-bigquery-storage-core 2.25.0 pyhca7485f_0
Related issues:
googleapis/python-bigquery-sqlalchemy#399
googleapis/python-bigquery-pandas#698
googleapis/python-bigquery-dataframes#816