-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Check whether GBQ Job is finished #9141
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
Conversation
jobComplete can be False in query_reply. Simply checking for the existence of the field isn't enough, as a False value will cause a KeyError when checking for query_reply['totalRows']
@@ -185,7 +185,7 @@ def run_query(self, query): | |||
|
|||
job_reference = query_reply['jobReference'] | |||
|
|||
while(not 'jobComplete' in query_reply): | |||
while(not 'jobComplete' in query_reply) or (query_reply['jobComplete'] is False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually I would prefer not query_reply['jobComplete']
to query_reply['jobComplete'] is False
you could also consolidate these with while(not query_reply.get('jobComplete', False))
@shoyer I like the get method. Added a comment to make it blatantly obvious why the loop is there. |
@jacobschaer pls have a look |
Isn't this similar to #8728 ? We are waiting for Google's response to http://stackoverflow.com/questions/27810116/google-bigquery-request-too-large |
Looks like this is the same issue as #8728. The code is exactly the same. I can see in that issue that the existing code came right from Google's example, however the API reference for getQueryResults regarding the jobComplete key states:
So clearly we need to check the value of jobComplete before moving on to grabbing totalRows. The thread you've referenced at SO is regarding an issue with inserts, why is that holding up this unrelated change? |
It's being held up because we wanted to get the intergration suite to pass before giving this the go ahead. The other PR I referenced had a couple of changes from @shaun-schaefer that was supposed to go in as well and needed testing. At this point though, I am wondering if we should just proceed with the understanding that the test suite has a known issue. |
Gotcha. I'd argue that having read_gbq() return data reliably is more valuable than passing all integration tests, especially since the BQ API is still evolving. |
@jacobschaer how's the testing coming? |
closing in favor of #8728 (its the older issue). |
xref #8728
jobComplete can be False in query_reply. Simply checking for the existence of the field isn't enough, as a False value will cause a KeyError when checking for query_reply['totalRows']