GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: retry 404 errors in `Client.query(...)` by tswast · Pull Request #2135 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
Contributor
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #2134 🦕
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: even though I add the retry here, we'll still need the one in
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought: Does this make it so that the queries retry if the table is not found? Or is this only going to happen for query job not found.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😢 It does hang / retry too much. Tested with import google.cloud.bigquery client = google.cloud.bigquery.Client() job = client.query("SELECT * FROM `swast-scratch.my_dataset.doesntexistnoreally`") job.result() Need to play a similar trick as with
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in latest commit.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
tswast
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @parthea Do you have any thoughts on how stable this will be? I couldn't find any public way to pull out the previous predicate from a Retry object when looking at the https://github.com/googleapis/python-api-core/blob/main/google/api_core/retry/retry_base.py code.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternative to consider: do something like I did with retry versus job_retry and introduce more parameters for job_insert_retry and job_get_retry or something like that.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed https://github.com/googleapis/python-api-core/issues/796, in the meantime I'll pursue an alternative that doesn't require access to private attributes.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
tswast
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @parthea likewise here. I ended up using a slightly different pattern here due to the double nesting of retry objects.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
system-3.12 failure: Edit: Actually, it does appear to be related. It's a different kind of 404 -- trying to query a table in a different location. I'll see if I can disambiguate that from the job 404. Edit2: fixed in 8e20cb0. I use the message to disambiguate job not found from dataset/table not found based on the stack trace in #2134. System test passing locally (and much more quickly). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Kokoro (https://btx.cloud.google.com/invocations/91aed90f-987e-4200-be14-09717b48923f/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-bigquery%2Fpresubmit%2Fpresubmit/log) and system-3.12 and snippets tests are passing. Ready for review! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Cover is failing: I'll see if I can update a unit test for this soon. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Coverage for I updated the patched retry object to use the correct one. This ensures that the 404 is retried until the timeout for the retry object. Edit: Confirmed that the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| with pytest.raises(DataLoss, match="we lost your job, sorry"): | ||
| client.query("SELECT 1;", job_id=None) | ||
|
|
||
| def test_query_job_rpc_fail_w_conflict_random_id_job_fetch_fails_no_retries(self): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you help me understand what this test is for? It feels like we are just verifying that QueryJob._begin() and client.get_job() are called.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you, lgtm.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Client.query() sometimes raises 404, despite the query job being successfully started
There was an error while loading. Please reload this page.