如何在没有 gcloud 或 gsutil 的情况下设置 "bq" (bigquery) shell 命令?

How can I setup "bq" (bigquery) shell command without gcloud or gsutil?

我想给"bq"命令之外的服务帐户信息作为参数,以便灵活地更改其身份验证。我将一些选项传递给 "bq" 命令,例如:

$ bq load --service_account=<my_service_account>
          --service_account_credential_file=<credential_output>
          --service_account_private_key_file=<path_to_pem>
          --project_id=<my_project>
          <dataset>.<table> <localfile> <schema>

使用我的帐户使用 gsutil 配置后,它在我的本地 PC 上运行良好,但似乎 "bq" 命令在使用 "gcloud" 或 "gsutil" 配置之前不接受任何命令即使提供了服务帐户信息:

> You do not currently have an active account selected.
> Please run:
> 
> $ gcloud auth login
> 
> to obtain new credentials, or if you have already logged in with a different account:
>     
> $ gcloud config set account ACCOUNT
> 
> to select an already authenticated account to use.

我可以用"bq"达到这个目的吗?我试过导出 GOOGLE_APPLICATION_CREDENTIALS 环境,但它似乎不起作用。

提前致谢。

对于"bq"中的身份验证,有"init"命令。但即使你 运行:

bq init

系统returns以下警告:

The "init" command is no longer needed with the Cloud SDK.
To authenticate, run gcloud auth.

因此,似乎没有推荐的方法仅从 "bq" 进行身份验证而不使用 "gcloud"。