-
Notifications
You must be signed in to change notification settings - Fork 285
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
query_and_wait
use in Cursor.execute
breaks default_query_job_config
in SQLAlchemy BQ Dialect
#1867
Labels
api: bigquery
Issues related to the googleapis/python-bigquery API.
Comments
product-auto-label
bot
added
the
api: bigquery
Issues related to the googleapis/python-bigquery API.
label
Mar 22, 2024
Can you take a look at this? |
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 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment details
python --version
3.8pip --version
20.0.2google-cloud-bigquery
version:pip show google-cloud-bigquery
3.19.0Steps to reproduce
query_and_wait
-- it is interactivequery
-- it is batchCode example
Details
query_and_wait
does not respect all of theQueryJobConfig
options. This is because it seems to go through a different API (jobs.query
rather thanjobs.insert
), andjobs.query
doesn't even seem to respect some of these.The
query_and_wait
call above ultimately performs ajobs.query
call with this payload:{"labels": {"test": "test2"}, "priority": "BATCH", "useLegacySql": false, "formatOptions": {"useInt64Timestamp": true}, "query": "SELECT \\"query_and_wait\\"", "requestId": "..."}
The
query
call performs this:'{"jobReference": {"jobId": "...", "projectId": "..."}, "configuration": {"query": {"priority": "BATCH", "useLegacySql": false, "query": "SELECT \\"query\\""}, "labels": {"test": "test2"}}}'
Note:
priority
is not in thejobs.query
API, but impact goes beyond this one particular option inQueryJobConfig
. Labels happens to work because labels happens to be part of thejobs.query
API.Impact
Although a caller could just migrate from
query_and_wait
toquery
if they were making the call, this is not an option with SQLAlchemy.The
Cursor.execute
function, from the dbapi, as an optimization, will callquery_and_wait
without a job ID. This breaks the ability in SQLAlchemy interactions with BigQuery to supply default query job configs, which is explicitly a goal of the library. "For situations like these, or for situations where you want the Client to have a default_query_job_config you can pass many arguments in the query of the connection string."The text was updated successfully, but these errors were encountered: