【问题标题】:How to authenticate in Google Big Query using Bigrquery without user input using a service account如何使用 Bigquery 在 Google Bigquery 中进行身份验证,而无需使用服务帐户进行用户输入
【发布时间】:2019-07-16 14:29:01
【问题描述】:

我需要使用 Windows 任务调度程序运行 R 脚本,但是该脚本包含使用 Bigrquery 对 Big Query 的身份验证。我有服务帐户身份验证。当我运行脚本时,我被要求输入用户输入,这不允许我按计划运行脚本。我明白了:

The bigrquery package is requesting access to your Google account. 
Select a pre-authorised account or enter '0' to obtain a new token. Press 
Esc/Ctrl + C to abort

1. ("Account I've used to authenticate")

这是我的代码:

library(googleAuthR)
library(bigrquery)

scopes = c("https://www.googleapis.com/auth/bigquery")


options(googleAuthR.scopes.selected = scopes)
service_token <- gar_auth_service(json_file="somejason.json")
gar_auth_service("somejason.json")


projectid<-'project_id'
datasetid<-'id'
bq_conn <-  dbConnect(bigquery(), 
                      project = projectid,
                      dataset = datasetid, 
                      use_legacy_sql = FALSE
)

tables_list <- dbListTables(bq_conn)

The bigrquery package is requesting access to your Google account. Select 
a pre-authorised account or enter '0' to obtain a new token. Press 
Esc/Ctrl + C to abort.

1: ("Account I've used to authenticate")

有没有一种无需用户输入即可通过服务帐户进行身份验证的方法?

【问题讨论】:

    标签: r authentication bigrquery


    【解决方案1】:

    所以我读了How to authenticate with service account and bigrquery package?

    建议使用 set_service_token(path='somejson.json') ,但已弃用。相反,我使用了 bq_auth(path='somejson.json')。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-16
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 2016-01-31
      • 2015-03-13
      • 1970-01-01
      相关资源
      最近更新 更多