Google bigquery Bigquery不接受Stackdriver';作者身份

Google bigquery Bigquery不接受Stackdriver';作者身份,google-bigquery,google-cloud-platform,stackdriver,google-python-api,Google Bigquery,Google Cloud Platform,Stackdriver,Google Python Api,我一直在遵循文档将日志从Stackdriver导出到Bigquery。我尝试了以下方法: from google.cloud.logging.client import Client as lClient from google.cloud.bigquery.client import Client as bqClient from google.cloud.bigquery.dataset import AccessGrant import os os.environ['GOOGLE_APP

我一直在遵循文档将日志从Stackdriver导出到Bigquery。我尝试了以下方法:

from google.cloud.logging.client import Client as lClient
from google.cloud.bigquery.client import Client as bqClient
from google.cloud.bigquery.dataset import AccessGrant

import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path_to_json.json'

lc = lClient()
bqc = bqClient()

ds = bqc.dataset('working_dataset')
acc = ds.access_grants
acc.append(AccessGrant('WRITER', 'groupByEmail', 'cloud-logs@system.gserviceaccount.com')) #this is the service account that is shown in our Exports tab in GCP.
ds.access_grants = acc
ds.update()
但是我们得到了错误信息:

NotFound: 404 Not found: Email cloud-logs@system.gserviceaccount.com (PUT https://www.googleapis.com/bigquery/v2/projects/[project-id]/datasets/[working-dataset])

为什么我们的数据集不更新?正在使用的键是已经创建数据集本身的键。

我想,gserviceaccount不是一个组。您介意将“groupByEmail”更改为“userByEmail”吗?您好@xuejian,刚刚尝试过,但收到不同的错误消息:
BadRequest:400无法从数据集中删除所有所有者。
。当我第一次得到ds.access\u grants时,它确实是空的(不知道为什么)。嗨@xuejian,我刚刚再试了一次,但这次我在更新中插入了另一个
AccessGrant
对象,它与以前的所有者一起工作,效果非常好!如果你愿意,请写下你的评论作为回答,我会接受的。它也可能帮助那些有同样问题的人