-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
BigQuery: Add QueryResults.reload() function which calls getQueryResults #3506
Comments
I figured out that I can force a reload with
but obviously, that's not ideal for the purpose of waiting for a job to finish. |
If you are going to iterate over the rows anyway, then that second example becomes: for row in query_results.fetch_data():
do_something_with(row) That certainly seems like "idiomatic" usage. Does that accomplish what you need? |
No. The results might not all be there. That's why I need a reload function to check if the query is complete or not. (A bit hard to test, since it requires a query that takes longer than the timeout value, which defaults to 10 seconds). |
A reload function probably isn't the best solution. After thinking about this, I think |
I don't think |
After I've played around with some proposed designs for GA, I agree with you, Jon. QueryJob's implementation of futures interface will be sufficient. I've changed this request back to asking for Closing this issue since I'm tracking internally in GA redesign doc. |
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults
One of the things I learned when talking to the BigQuery API folks is that the recommended way to run a query is to create a query job and then call
getQueryResults()
until thejobComplete
property istrue
.The reason for this is that a call to get the job resource will return immediately, whereas
getQueryResults
will return after a timeout or the query is complete, whichever comes first. WithgetQueryResults
users get their data faster.This means the code for waiting for a query job to complete would change from
to something like
The text was updated successfully, but these errors were encountered: