Unable to read BigQuery table from Datalab

223 views
Skip to first unread message

shixio...@mediacom.com

unread,
Apr 17, 2019, 9:51:59 AM4/17/19
to gce-discussion
Hi, 

I am very new to GCP and i have been trying to read a table from bigquery into datalab dataframe, but i was unable to do so. Would appreciate if someone here could help me with this issue please. 

When i run the following code. 

query="""
SELECT
  *
FROM
  `myproject.mydataset.my_training_table`
"""

import google.datalab.bigquery as bq
df
= bq.Query(query).execute().result().to_dataframe()
df
.head()

i am constantly getting this error message:

---------------------------------------------------------------------------
RequestException                          Traceback (most recent call last)
<ipython-input-15-7581c743c361> in <module>()
      8 
      9 import google.datalab.bigquery as bq
---> 10 df = bq.Query(query).execute().result().to_dataframe()
     11 df.head()

/usr/local/envs/py3env/lib/python3.5/site-packages/google/datalab/bigquery/_query.py in execute(self, output_options, sampling, context, query_params)
    337     """
    338     return self.execute_async(output_options, sampling=sampling, context=context,
--> 339                               query_params=query_params).wait()
    340 
    341   @staticmethod

/usr/local/envs/py3env/lib/python3.5/site-packages/google/datalab/bigquery/_query_job.py in wait(self, timeout)
     82                                                     timeout=poll * 1000)
     83       except Exception as e:
---> 84         raise e
     85       if query_result['jobComplete']:
     86         if 'totalBytesProcessed' in query_result:

/usr/local/envs/py3env/lib/python3.5/site-packages/google/datalab/bigquery/_query_job.py in wait(self, timeout)
     80                                                     project_id=self._context.project_id,
     81                                                     page_size=0,
---> 82                                                     timeout=poll * 1000)
     83       except Exception as e:
     84         raise e

/usr/local/envs/py3env/lib/python3.5/site-packages/google/datalab/bigquery/_api.py in jobs_query_results(self, job_id, project_id, page_size, timeout, start_index)
    228     }
    229     url = Api._ENDPOINT + (Api._QUERIES_PATH % (project_id, job_id))
--> 230     return google.datalab.utils.Http.request(url, args=args, credentials=self.credentials)
    231 
    232   def jobs_get(self, job_id, project_id=None):

/usr/local/envs/py3env/lib/python3.5/site-packages/google/datalab/utils/_http.py in request(url, args, data, headers, method, credentials, raw_response, stats)
    156           return json.loads(str(content, encoding='UTF-8'))
    157       else:
--> 158         raise RequestException(response.status, content)
    159     except ValueError:
    160       raise Exception('Failed to process HTTP response.')

RequestException: HTTP request failed: Not found: Job quixotic-art-232810:job_piFp0dzC-ojqRsNizzA0elbexi97


but when i switch the table source to some google public dataset, i am able to run the code successfully.  Any help/advice on this would be greatly appreciated. Thanks!

Ali T (Cloud Platform Support)

unread,
Apr 23, 2019, 4:48:42 PM4/23/19
to gce-discussion
From the jobID in the stacktrace, the dataset being called is in the region asia-southeast-1. I created a dataset in that region and also got the same error message. I then created multiple datasets across various regions and the error message was consistent except if the dataset was located in the EU or US multi-region

I opened an issue tracker on your behalf to have the Datalab engineering team have a look at this matter. I would suggest starring the issue as it subscribes you to future updates related to this matter.  

Reply all
Reply to author
Forward
0 new messages