This repository was archived by the owner on Mar 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 325
Autodetect for BQ happening automatically even with schema defined. #847
Copy link
Copy link
Closed
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.Invalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.externalThis issue is blocked on a bug with the actual product.This issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.Invalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Issue
I'm currently using the python sdk to transform and load data into BQ. One of the fields I have is supposed to be a string but the data will come in as either a long float number (ex:
75257229615211513551680283362634662820), int number ( ex:4), or string (ex:http://some-string-url).So the data representation looks like
Since BQ does the auto detection, these values can be recognized as either a FLOAT, INT, or STRING. I followed docs, and stack recommendations to assign a hard schema to the config which looks like
The schema is read in from a json file that looks like
and parsed into the SchemaField() object..
Just to be clear i do believe that this is apart of a
subschemaand assigned to thefieldsas it's an array of objects.then i submit the data through the SDK via the
load_table_from_jsonwhich looks likeAll fairly straightforward, and follows closely with what is documented and shared by others. BUT for whatever reason, the API request will fail and continue to try parse
valueas either a STRING, FLOAT or INT even with the schema defined.So a couple questions here... is this a bug with BQ, or the SDK not accepting the schema? Am i doing something wrong here? Does the autodetect feature always do its thing even when turned off and a schema defined?
Any communication here would be greatly appreciated.
Cheers
info
sdk version:
google-cloud-bigquery 2.20.0os: MacOS
environment: Cloud Function
python version: 3.9