Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials. の対応
Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials. の対応
Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.
の対応方法。
Error: googleapi: Error 403: Request had insufficient authentication scopes. の対応 - hene.dev にプラスして、 権限を付与する必要があった。
エラー
スプレッドシートの権限がない。
$ poetry run dbt run -s dim_accounts
HH:MM:SS Running with dbt=1.1.0
HH:MM:SS Found 503 models, 3408 tests, 0 snapshots, 43 analyses, 421 macros, 0 operations, 14 seed files, 523 sources, 0 exposures, 0 metrics
HH:MM:SS
HH:MM:SS Concurrency: 4 threads (target='dev')
HH:MM:SS
HH:MM:SS 1 of 1 START table model project_name_dev_marts.dim_accounts ..... [RUN]
HH:MM:SS 1 of 1 ERROR creating table model project_name_dev_marts.dim_accounts [ERROR in 1.69s]
HH:MM:SS
HH:MM:SS Finished running 1 table model in 4.14s.
HH:MM:SS
HH:MM:SS Completed with 1 error and 0 warnings:
HH:MM:SS
HH:MM:SS Database Error in model dim_accounts (models/marts/project_name_a/dim_accounts.sql)
HH:MM:SS Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.
HH:MM:SS compiled SQL at target/run/repository_name/models/marts/project_name_a/dim_accounts.sql
HH:MM:SS
HH:MM:SS Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
対応
Google Drive
へのアクセス権限を付与する。
BigQueryでGoogleドライブデータへのクエリでエラーが出るときの対処
$ gcloud auth application-default login \
--scopes="https://www.googleapis.com/auth/drive","https://www.googleapis.com/auth/cloud-platform"
動作確認
dbt run
を実行できる。
$ poetry run dbt run -s dim_accounts
HH:MM:SS Running with dbt=1.1.0
HH:MM:SS Found 999 models, 9999 tests, 999 snapshots, 999 analyses, 999 macros, 0 operations, 99 seed files, 999 sources, 99 exposures, 99 metrics
HH:MM:SS
HH:MM:SS Concurrency: 4 threads (target='dev')
HH:MM:SS
HH:MM:SS 1 of 1 START table model project_name_dev_marts.dim_accounts ..... [RUN]
HH:MM:SS 1 of 1 OK created table model project_name_dev_marts.dim_accounts [CREATE TABLE (1.2m rows, 540.2 MB processed) in 11.84s]
HH:MM:SS
HH:MM:SS Finished running 1 table model in 15.00s.
HH:MM:SS
HH:MM:SS Completed successfully
HH:MM:SS
HH:MM:SS Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1