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. の対応 にプラスして、 権限を付与する必要があった。
エラー
スプレッドシートの権限がない。
$ poetry run dbt run -s fct_hogehoge_users
11:05:31 Running with dbt=1.1.0
11:05:33 Found 503 models, 3408 tests, 0 snapshots, 43 analyses, 421 macros, 0 operations, 14 seed files, 523 sources, 0 exposures, 0 metrics
11:05:34
11:05:36 Concurrency: 4 threads (target='dev')
11:05:36
11:05:36 1 of 1 START table model project_name_dev_marts.fct_hogehoge_users ..... [RUN]
11:05:43 1 of 1 ERROR creating table model project_name_dev_marts.fct_hogehoge_users [ERROR in 1.69s]
11:05:43
11:05:43 Finished running 1 table model in 4.14s.
11:05:43
11:05:43 Completed with 1 error and 0 warnings:
11:05:43
11:05:43 Database Error in model fct_hogehoge_users (models/marts/project_name_a/fct_hogehoge_users.sql)
11:05:43 Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.
11:05:43 compiled SQL at target/run/repository_name/models/marts/project_name_a/fct_hogehoge_users.sql
11:05:43
11:05:43 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 fct_hogehoge_users
11:14:55 Running with dbt=1.1.0
11:15:00 Found 503 models, 3408 tests, 0 snapshots, 43 analyses, 421 macros, 0 operations, 14 seed files, 523 sources, 0 exposures, 0 metrics
11:15:00
11:15:03 Concurrency: 4 threads (target='dev')
11:15:03
11:15:03 1 of 1 START table model project_name_dev_marts.fct_hogehoge_users ..... [RUN]
11:15:15 1 of 1 OK created table model project_name_dev_marts.fct_hogehoge_users [CREATE TABLE (1.2m rows, 540.2 MB processed) in 11.84s]
11:15:15
11:15:15 Finished running 1 table model in 15.00s.
11:15:16
11:15:16 Completed successfully
11:15:16
11:15:16 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1