首页 > 解决方案 > 构建没有文件但直接解析凭据的 bigquery 客户端

问题描述

我正在尝试使用 google-cloud-bigquery 包。

当我想创建一个Client文件时,我可以指向一个文件的路径,例如

from google.cloud import bigquery
client = bigquery.Client.from_service_account_json("path/to/credentials/cred.json")

根据文档,我应该能够直接使用解析凭据

from google.cloud import bigquery
creds = get_creds_as_string() #Returns the credentials as a string
client = bigquery.Client.from_service_account_info(creds)

但这引发了

type object 'Client' has no attribute 'from_service_account_info'

这很奇怪,因为该方法在文档中进行了描述。

有没有办法直接解析凭据?

标签: pythongoogle-bigquery

解决方案


推荐阅读