-
Notifications
You must be signed in to change notification settings - Fork 310
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
load_table_from_json interpolates string as int #1228
Comments
This is a tough one. One possibility would be to omit any local schema interpolation (if there is any, I forget) and use an autodetect schema, instead. I suspect you should be able to work around this issue by manually supplying the correct schema in a job configuration object. |
New theory: I see we don't have any client-side schema generation. Instead, the client adds python-bigquery/google/cloud/bigquery/client.py Lines 2760 to 2761 in 66500b4
Perhaps omitting this flag when the table already exists will help? I suspect that the backend first attempts to generate a schema from the provided data and then compares that generated schema with the existing table. If this is the case, we should also file a backend issue (possibly in addition to adding a workaround in the client if the table already exists). |
I have been coming across the same issue when trying to load json files into BigQuery. I thought the problem was already fixed (#1248) but the issue is still around. How can we request that it is solved? This is the code that I am using to load data.
|
#1248 was never merged, so perhaps that fix is still relevant. Re: #1228 (comment) — if this turns out to be a backend issue we should absolutely file a bug with the correct team (and I'd propose not adding a client-side workaround since we'd have to undo it later and that might cause even more problems for folks). |
I think this is less of a backend bug, since we are sending conflicting information to the backend: |
We already do this in some other methods, such as python-bigquery/google/cloud/bigquery/client.py Lines 3928 to 3932 in 39f33b2
Note: We should only do this call to
|
Awesome, I'll go fix this issue. |
Truth table: under which condition we should check table existence, and whether client should set autodetect value for user.
|
I think my test sample was wrong, and the backend still throws an error if no schema is provided and |
If a table doesn't already exist, it used to be the case that either you had to specify a |
If the table does exist, you don't have to set anything. |
I think so. I'll just remove these two lines then. |
Issue
using
load_table_from_json()
to load data into a string column fails when using a value that can be interpolated as an int (eg. "123")see code snippet, which shows inconsistency with the other data loading apis
Environment details
pip --version
google-cloud-bigquery
version: 2.31.0 & 3.0.1Code example
Stack trace
The text was updated successfully, but these errors were encountered: