mys*_*ous 5 authentication r google-bigquery bigrquery
bigrquery我在从我编写的 R Markdown 文档中连接到 GCP 服务帐户时遇到问题。当我从控制台尝试时,身份验证工作正常。两个都
library(bigrquery)
bq_auth()
Run Code Online (Sandbox Code Playgroud)
和
library(bigrquery)
bq_auth(email="my-service-account-email@myproject.iam.gserviceaccount.com")
Run Code Online (Sandbox Code Playgroud)
启动带有对话框的浏览器,让我按预期使用指定的帐户进行选择和身份验证。但在 R Markdown 中,任何像这样的尝试
options("httr_oob_default" = TRUE)
bq_auth(email="my-service-account-email@myproject.iam.gserviceaccount.com")
Run Code Online (Sandbox Code Playgroud)
甚至使用这样的完整列表
bq_auth(
email = "my-service-account-email@myproject.iam.gserviceaccount.com",
path = NULL,
scopes = c("https://www.googleapis.com/auth/bigquery"),
cache = gargle::gargle_oauth_cache(),
use_oob = gargle::gargle_oob_default(),
token = NULL
)
Run Code Online (Sandbox Code Playgroud)
导致错误
Error: Can't get Google credentials.
Are you running bigrquery in a non-interactive session? Consider:
* Call `bq_auth()` directly with all necessary specifics.
Run Code Online (Sandbox Code Playgroud)
谁能看到我缺少什么吗?提前致谢。
您可以下载 Google Cloud 服务帐户的 JSON 文件,然后将其用作 \xe2\x80\x9cbq_auth\xe2\x80\x9d 函数可以识别的路径。步骤如下:
\nbigrquery::bq_auth(path = "/path/to/jsonfilename.json")注意:您需要确保将服务帐户设置为有权访问 BigQuery。我将其设置为“BigQuery Admin”并且它有效,但这可能太宽泛
\n从 Elaine See 在媒体上的帖子借用了这个答案:https://medium.com/@elaine.yl.see/easiest-way-to-use-bigquery-in-r-8af466cd55ca
\n| 归档时间: |
|
| 查看次数: |
1970 次 |
| 最近记录: |