BUG: The 'jobComplete' key may be present but False in the BigQuery query results by aaront · Pull Request #8728 · pandas-dev/pandas (original) (raw)
I ran a little test for this by adding a bit of code to to the existing 0.15 code:
while(not 'jobComplete' in query_reply): print('Job not yet complete...') query_reply = job_collection.getQueryResults( projectId=job_reference['projectId'], jobId=job_reference['jobId']).execute() if (not 'totalRows' in query_reply): print(query_reply) total_rows = int(query_reply['totalRows'])
And received the following output:
Job not yet complete...
{u'kind': u'bigquery#getQueryResultsResponse', u'etag': u'"1R8EtuJeC1ZTqaGooyltyIvODk8/W9GOBbLTm4BKUyjNgBAQorULao0"', u'jobComplete': False}
Here's the error stacktrace:
KeyError Traceback (most recent call last) in () 1 query = geotab.BigQueryBuilder('PerformanceTime', FROM_DATE, TO_DATE).build() ----> 2 df = pd.read_gbq(query, project_id='XXXXXX')
C:\Miniconda\envs\mygeotabenv\lib\site-packages\pandas\io\gbq.py in read_gbq(query, project_id, index_col, col_order, reauth) 369 370 connector = GbqConnector(project_id, reauth = reauth) --> 371 schema, pages = connector.run_query(query) 372 dataframe_list = [] 373 while len(pages) > 0:
C:\Miniconda\envs\mygeotabenv\lib\site-packages\pandas\io\gbq.py in run_query(self, query) 193 if (not 'totalRows' in query_reply): 194 print(query_reply) --> 195 total_rows = int(query_reply['totalRows']) 196 result_pages = list() 197 seen_page_tokens = list()
KeyError: 'totalRows'