Reputation: 7
I have a dataset with tables set up within Big Query which I can query just fine using the BQ UI, however I am getting an error when attempting to run a standard query from datalab.
I can get the table schema returned when I run
%%bq tables describe --name "my-project.my_dataset.my_table"
and also I can get access to the meta data
table1=bq.Table("my-project.my_dataset.my_table")
table1.metadata.rows
Result: 637043
However when I run
%%bq query --name testQuery
SELECT * FROM `my-project.my_dataset.my_table`
I receive the error
RequestException: HTTP request failed: Not found: Job my-project:job__SSPF9nCudKqIFZT8N4yvp_SUDb5
I have tried using the various different ways of sending the same query as well as sampling but no joy.
Has anyone experienced a similar issue?
Upvotes: 0
Views: 500
Reputation: 11
Had the same problem and found the solution here:
https://cloud.google.com/bigquery/docs/visualize-jupyter
Try to install this library:
pip install google-cloud-bigquery[pandas]
Call the magic notebook command:
%load_ext google.cloud.bigquery
And then run the query this way:
%%bigquery
SELECT
source_year AS year,
COUNT(is_male) AS birth_count
FROM `bigquery-public-data.samples.natality`
GROUP BY year
ORDER BY year DESC
LIMIT 15
Upvotes: 1