Mou*_*ess 5 google-drive-api google-bigquery google-cloud-platform google-deployment-manager
重现步骤:
view添加具有工作表权限的部署管理器服务帐户def GenerateConfig(context):
name: str = context.env['name']
dataset: str = context.properties['dataset']
tables: [] = context.properties['tables']
location: str = context.properties.get('location', 'EU')
resources = [{
'name': name,
'type': 'gcp-types/bigquery-v2:datasets',
'properties': {
'datasetReference': {
'datasetId': dataset,
},
'location': location
},
}]
for t in tables:
resources.append({
'name': '{}-tbl'.format(t["name"]),
'type': 'gcp-types/bigquery-v2:tables',
'properties': {
'datasetId': dataset,
'tableReference': {
'tableId': t["name"]
},
'externalDataConfiguration': {
'sourceUris': ['https://docs.google.com/spreadsheets/d/123123123123123-123123123123/edit?usp=sharing'],
'sourceFormat': 'GOOGLE_SHEETS',
'autodetect': True,
'googleSheetsOptions':
{
"skipLeadingRows": '1',
}
}
},
})
return {'resources': resources}
Run Code Online (Sandbox Code Playgroud)
我发现了一些诸如此类的线索,但它们都引用了使用“范围”来添加https://www.googleapis.com/auth/drive。我不确定如何将范围添加到部署管理器请求,或者范围实际上是如何工作的。
任何帮助,将不胜感激。
小智 1
是的,使用范围可以解决这个问题。但是,即使添加范围后,我也遇到了同样的错误。与 GCP 服务帐户共享 Google Sheets 文档帮助我摆脱了这个错误。
总结一下 - 使用范围并与您将用于查询表的 GCP 服务帐户共享文档。
另外,该文档对于查询外部表很有帮助
| 归档时间: |
|
| 查看次数: |
9323 次 |
| 最近记录: |