Elie Ladias
Elie Ladias

Reputation: 83

Google big query, 403 error unable to query the data via API

I am trying to query data from a public big query dataset via the bigquery client.

The problem I am facing is that in order to be able to do that I have understand that I need to have at least reader right in the project. The thing is as the project is public I don't have any way to change my grant on that project.

Is there any other way to do that ? did I miss something ?

Here is the code I am using:

bigquery_client = bigquery.Client(GDELT_ID)
LIMITED = 'SELECT * FROM [gdelt-bq:full.events_partitioned] LIMIT 100'
query = bigquery_client.run_sync_query(LIMITED)
query.run()   

And the error message:

google.cloud.exceptions.Forbidden: 403 Access Denied: Project gdelt-bq: The user ******@gmail.com does not have bigquery.jobs.create permission in project gdelt-bq. (POST https://www.googleapis.com/bigquery/v2/projects/gdelt-bq/queries)          

Thanks for your help

Upvotes: 1

Views: 4738

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172944

Looks like in first line you specify gdelt-bq (most likely behind your GDELT_ID) as an acting project. Of course you do not have permissions to use it as such. Instead - you should point to your own project or just leave it empty, so it will be set to default inferred from the environment

bigquery_client = bigquery.Client()

Upvotes: 3

Related Questions