-
Notifications
You must be signed in to change notification settings - Fork 124
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
df.to_gbq(): InvalidSchema when using 'type': 'INT64' and if_exists = 'append' #322
Comments
Is there a workaround that anyone has found? |
Hi @Azerane, Maybe you get that error because you use Maybe it can help you too @norbertsteele |
I'm able to reproduce with the following code example: import pandas_gbq
df1 = pandas.DataFrame({"int_col": [1, 2, 3]})
pandas_gbq.to_gbq(
df1,
"my_dataset.int64table",
table_schema=[{"name": "int_col", "type": "INT64"}]
)
df2 = pandas.DataFrame({"int_col": [4, 5, 6]})
# This fails, despite using the same schema as was used for the initial
# upload.
pandas_gbq.to_gbq(
df2,
"my_dataset.int64table",
table_schema=[{"name": "int_col", "type": "INT64"}],
if_exists="append", |
Workaround is to use legacy SQL type names ( |
Had this error in few days. The problem is with wrong error handling. The issue I had was - pandas dataframe did not have datetime columns converted as specified in supplied schema. The integer error, at least for me was a false flag. Bellow fraction of the code solved it for me:
And scema json:
|
Hello there,
I'm facing an issue with the function
df.to_gbq()
From my understanding, it seems that when we are using
if_exists = 'append'
when the destination_table already exists, we are retrieving the original_schema from destination_table.The original_schema will contain every fields but type retrieve is
INTEGER
and notINT64
anymore.Since the code is simply checking that all fields in the
schema_local
are the same in theschema_remote
, this conducts to a missmatch and functionschema_is_subset
is returningFalse
instead ofTrue
.I'm not sure about where we should fix this error, but it's kind of annoying when working with integers values.
The text was updated successfully, but these errors were encountered: