Haipeng Su
Haipeng Su

Reputation: 2541

Using bq command in datalab - credentials needed

I am trying to use bq command inside datalab, but when I try to use it, it pops up a message and require me to set up my credentials, as shown below,

enter image description here

However, I can't paste the verification code into the pop message. Basically, I was stuck on this step.

  1. I checked my gcloud configurations in datalab, it shows me the right project and account.
  2. I can use bq commands in my terminal, which works fine, no need to authorize every time.

Any idea how to solve this? Thank you.

Upvotes: 0

Views: 416

Answers (1)

Bradley Jiang
Bradley Jiang

Reputation: 424

In the long term, I think we will save the Datalab credentials for BQ. then after signing in Datalab, !bq will use saved credentials.

As a workaround, you can run bq outside Datalab with interactive command prompt, go through the token verification process, and then copy the token file into Datalab. For example, assume you have done the verification process on the machine hosting Datalab, you can copy the creds file into Datalab by running the following cell:

!cp /content/.bigquery.v2.token ~/.bigquery.v2.token

And you need to do it every time you restart Datalab.

Upvotes: 2

Related Questions