I have a dbt-core project with the following projects.yml:
test:
target: dev
outputs:
dev:
type: bigquery
method: oauth
project: my-project-id-123456
dataset: dbt_name
location: EU
threads: 8
I had 2 Google accounts (private + business) with the same email name for some unknown reason and had to delete the private account to be able to use the business account fully. But I had already used OAuth with the now deleted account and everytime I try to run dbt-core now I get the following error:
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'})
I can't find a way to use my other account for OAuth? Already deleted my whole .venv folder and reinstalled dbt-bigquery.
Apparently dbt-core uses gcloud cli for OAuth. You can reforce a relogging (and choose a new account there) via this answer: how to switch GCP authentication account for dbt-BigQuery runs
So the way to switch to a different GCP account is to do
gcloud auth application-default login
in the google cloud cli.
I used the locally installed gcloud cli, I don't know if it works with the BQ shell in BQ directly.