can't upload an int64 column dtype (or object dtype containing integers) to a string column in BigQuery #875
Labels
api: bigquery
Issues related to the googleapis/python-bigquery-pandas API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
If I have a DataFrame that contains int64 or object dtype containing integers, I'd like to be able to upload it with
to_gbq
to a table with string columns. For example:This fails with
Error converting Pandas column with name: "zip_code" and datatype: "int64" to an appropriate pyarrow datatype: Array, ListArray, or StructArray
Describe the solution you'd like
If a cast from the local type to the BigQuery type would be lossless (as is the case with integer to string), pandas-gbq should automatically do that before trying to create a parquet file.
Describe alternatives you've considered
Two workarounds:
api_method="load_csv"
toto_gbq(df, table_schema=..., api_method="load_csv")
Additional context
Reported by a customer in an email sent to me.
The text was updated successfully, but these errors were encountered: