Reputation: 1379
I am trying to load data from a Big query table to pandas dataframe. I followed the syntax given in the documentation here. Unfortunately, I am getting the error below.
I read a stackoverflow solution here, and followed its solution but I got this.
Then, I tried separating the code lines, but I get a new error UsageError: Line magic function
%%bigquery not found.
I have been trying for a couple of hours to resolve this. Even restarting the kernel is not working. This works the very first time you run it but not if you run it twice. I have no clue what's going on. Any thoughts?
Upvotes: 1
Views: 6892
Reputation: 7912
Make sure you have run:
%load_ext google.cloud.bigquery
in a separate cell.
(And don't put comments before the line with %%bigquery
in it, as the other answer says.)
Upvotes: 8
Reputation: 2994
This can be solved by removing the comments
#-----------------------
#Loading the bigquery ..
#-----------------------
and just retaining the %%bigquery
magic syntax as shown below
%%bigquery personas_raw
SELECT * FROM `project-id.dataset.table`
Here is the screenshot of my testing using a sample public dataset WITH COMMENTS and got the same error message as your post.
And here is the screenshot of the same syntax when the comment is removed.
Upvotes: 4