I have this code written in python3.
from google.cloud import bigquery
import json
timeframe = '2006'
client = bigquery.Client()
query_job = client.query("SELECT * FROM `fh-bigquery:reddit_comments.{}` LIMIT 05".format(timeframe))
results = query_job.result()
After setting the environment variable as it says to in https://cloud.google.com/bigquery/create-simple-app-api
set GOOGLE_APPLICATION_CREDENTIALS=[PATH]
I get the following error:
google.api_core.exceptions.BadRequest: 400 GET https://www.googleapis.com/bigquery/v2/projects
/ravischat-214114/queries/f936b73e-cf46-4fc5-b161-b05474c41560?maxResults=0:
Project name needs to be separated by dot from dataset name,
not by colon in table name "fh-bigquery:reddit_comments.2006".
Any help for solving the error would be greatly appreciated!
If I need to set the path to the authentication JSON file directly in the code, if someone could tell me how to do that, I would greatly appreciate it.
According to the error displayed, change:
`fh-bigquery:reddit_comments.2006`
to:
`fh-bigquery.reddit_comments.2006`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With