我有一个 dbt-core 项目,其中包含以下项目.yml:
test:
target: dev
outputs:
dev:
type: bigquery
method: oauth
project: my-project-id-123456
dataset: dbt_name
location: EU
threads: 8
由于某种未知原因,我有 2 个具有相同电子邮件名称的 Google 帐户(私人 + 企业),并且必须删除私人帐户才能完全使用企业帐户。但我已经将 OAuth 与现已删除的帐户一起使用,每次我尝试运行 dbt-core 时都会收到以下错误:
Runtime Error
Unable to generate access token, if you're using impersonate_service_account make sure your initial account has the "roles/iam.serviceAccountTokenCreator" role on the account you are trying to impersonate.
('invalid_grant: Account has been deleted', {error': 'invalid_grant', 'error_description': 'Account has been deleted'})
我找不到使用我的其他帐户进行 OAuth 的方法?已经删除了我的整个 .venv 文件夹并重新安装了 dbt-bigquery。
显然 dbt-core 使用 gcloud cli 进行 OAuth。您可以通过以下答案重新强制重新记录(并在此处选择一个新帐户):how to switch GCP authentication account for dbt-BigQuery running
所以切换到不同的GCP帐户的方法是
gcloud auth application-default login
在谷歌云cli中。
我使用的是本地安装的gcloud cli,不知道是否可以直接与BQ中的BQ shell一起使用。