0
votes

I want to retrieve data from Google big query. But user authentication is not happening for me. This is the message I am getting.

"Access Denied: Project bigquery-public-data: The user [email protected] does not have bigquery.jobs.create permission in project bigquery-public-data"

Here is the code:

from google.cloud import bigquery
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file(
    'NYCTaxi-c81bd00c9864.json')
project_id = 'bigquery-public-data'
client = bigquery.Client(credentials= credentials,project=project_id)

query_job = client.query("""
  SELECT *
  FROM new_york.tlc_yellow_trips_2016
  LIMIT 1000""")
results = query_job.result()  # Waits for job to complete.
1

1 Answers

1
votes

In below line you should set your own project

project_id = 'bigquery-public-data'

so it will be as

project_id = 'your_project'

And in query itself you shoud add project as below

query_job = client.query("""
  SELECT *
  FROM `bigquery-public-data.new_york.tlc_yellow_trips_2016`
  LIMIT 1000""")