google-cloud-platform - 使用 Deployment Manager 在 BigQuery 中创建“外部表”时出现“403 Permission denied while getting Drive credentials”
问题描述
重现步骤:
- 在 Google 表格中创建表格
- 在 Google Cloud Platform 中启用 Deployment Manager 和 Google Drive API
view
在工作表上添加具有权限的部署管理器服务帐户- 使用部署管理器创建数据集
- 使用部署管理器创建表,在 sourceUris 中引用外部工作表
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}
我发现了一些这样的线索,但它们都引用了“范围”来添加https://www.googleapis.com/auth/drive
。我不确定如何将范围添加到部署管理器请求,或者范围如何工作。
任何帮助,将不胜感激。
解决方案
是的,使用范围可以解决问题。但是,即使在添加范围之后,我也面临同样的错误。与 GCP 服务帐户共享 google 表格文档帮助我摆脱了这个错误。
总结 - 使用范围并与您将用于查询表的 GCP 服务帐户共享文档。
另外,本文档对查询外部表很有帮助
推荐阅读
- react-native - 如何修复 React Native 中自定义标签栏的行为?
- python-asyncio - 使用 asyncio 完成多项终极工作
- amazon-web-services - 如何在没有任何代码的情况下将来自 websocket 的数据放到亚马逊 kinesis 数据流中(仅通过使用托管 aws 服务)?
- apache - Cloudflare 重定向到 https://www
- python - 如何在python 2.7中制作大量文件
- elm - create-elm-app:如何通过反向代理运行 elm-app start
- django - 如何在 objects.get() 函数中设置动态字段名称
- python - 如何获取原始套接字数据包并将其转换为可读的 http 请求
- java - 用于 mongodb 集合的适当 shrad-key
- mediawiki - 如何移动 mediawiki 'Echo' 扩展图标?