hyvel
hyvel

Reputation: 19

Query from Bigquery using local command line

I'm trying to query from BigQuery using PowerShell. I've initialised gcloud init and logged in to my account.
The request was this:

bq query --use_legacy_sql=false 'SELECT customer_id FROM `demo1.customers1`'

Resulting with this error:

BigQuery error in query operation: Error processing job
'PROJECT-ID:bqjob': Access Denied:
BigQuery BigQuery: Permission denied while getting Drive credentials.

This worked when I run it in cloud shell.

I've created a service account before and a key for the project. I tried to run this command and doesn't solve it:

gcloud auth activate-service-account [email protected] --key-file=D:/folder/key.json --project=MYPROJECT_ID

Upvotes: 0

Views: 484

Answers (1)

Prajna Rai T
Prajna Rai T

Reputation: 1828

Service account should have the OAuth scope for Drive to access drive, below command can be used to authenticate with Drive.

gcloud auth login --enable-gdrive-access

Upvotes: 1

Related Questions