You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
query_and_wait use in Cursor.execute breaks default_query_job_config in SQLAlchemy BQ Dialect #1867
query_and_wait does not respect all of the QueryJobConfig options. This is because it seems to go through a different API (jobs.query rather than jobs.insert), and jobs.query doesn't even seem to respect some of these.
The query_and_wait call above ultimately performs a jobs.query call with this payload: {"labels": {"test": "test2"}, "priority": "BATCH", "useLegacySql": false, "formatOptions": {"useInt64Timestamp": true}, "query": "SELECT \\"query_and_wait\\"", "requestId": "..."}
Note: priority is not in the jobs.query API, but impact goes beyond this one particular option in QueryJobConfig. Labels happens to work because labels happens to be part of the jobs.query API.
Impact
Although a caller could just migrate from query_and_wait to query if they were making the call, this is not an option with SQLAlchemy.
Activity
chalmerlowe commentedon Mar 25, 2024
@tswast
Can you take a look at this?
tswast commentedon Mar 25, 2024
I find it strange that the backend eats unsupported properties in the request body, but that does appear to be the behavior.
We do have a denylist of properties we know aren't supported by
jobs.queryhere:python-bigquery/google/cloud/bigquery/_job_helpers.py
Lines 509 to 522 in b0e95a0
Switching this to an allowlist of properties we know are supported should fix this issue.