Google Big-Query API 403-禁止的例外 [英] Google Big-query api 403-Forbidden Exception
问题描述
使用Big-Query API的Java应用程序执行查询时,出现以下JSON异常.以下是我得到的例外:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "accessDenied",
"message": "Access Denied: Job eco-span-847:job_LyHmZIvlY1_0J8JQ3pxThEBf19I: The user does not have permission to run a query in project eco-span-847"
}
],
"code": 403,
"message": "Access Denied: Job eco-span-847:job_LyHmZIvlY1_0J8JQ3pxThEBf19I: The user does not have permission to run a query in project eco-span-847"
}
}
为什么会发生这种情况,我该如何解决?
要在项目中插入查询作业,调用用户必须至少是该项目上的Reader.
使用BigQuery API时,您需要为某些用户使用OAuth凭据构建客户端.对于程序访问,这通常是服务帐户标识.创建新的服务帐户时,该帐户不会自动添加到项目中.
要更新属于项目成员的用户和服务帐户,请访问 https://console.developers.google.com/对于您的项目,请在导航面板中选择权限",并确保与您通话的用户或服务帐户标识是该项目上的阅读器".
I am getting the following JSON exception while I am executing the query using the java application for Big-Query API. Following is the exception I am getting:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "accessDenied",
"message": "Access Denied: Job eco-span-847:job_LyHmZIvlY1_0J8JQ3pxThEBf19I: The user does not have permission to run a query in project eco-span-847"
}
],
"code": 403,
"message": "Access Denied: Job eco-span-847:job_LyHmZIvlY1_0J8JQ3pxThEBf19I: The user does not have permission to run a query in project eco-span-847"
}
}
Why is this occurring and how could I resolve this?
To insert a query job in a project the calling user must be at least a Reader on the project.
When using the BigQuery API, you need to construct the client with OAuth credentials for some user. For programmatic access, this is often a Service Account identity. When you create a new Service Account, that account is not automatically added a membership role to your project.
To update the users and service accounts that are members of your project, go to https://console.developers.google.com/ for your project, select "Permissions" in the navigation panel, and make sure the user or service account identity you are calling with is a "Reader" on the project.
这篇关于Google Big-Query API 403-禁止的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!