Bigquery - Silent Login

I am using the large command line Query. when i use gcloud auth login it asks for login. and when for Unix I need to get the authorization code.

Is there a way that I can put the credentials somewhere (with a password) so that I don't have to do it manually? I am trying to automate it. I can use the secret key for the same.

+3


source to share


1 answer


You can use the service account file for authentication:

bq --service_account=someServiceAccount.gserviceaccount.com \ 
   --service_account_credential_file=~/clok_cred.txt \
   --service_account_private_key_file=/somekeyFile.p12 \
   --project_id=formal-cascade-571 \
   query "select * from dw_test.clokTest"

      



See also How to get gcloud auth activate-service-account persist ".

Docs: https://developers.google.com/cloud/sdk/gcloud/reference/auth/activate-service-account

+2


source







All Articles