【发布时间】:2019-03-01 21:17:47
【问题描述】:
我正在尝试从数据存储中获取所有数据实体。当我遇到谷歌文档时,我发现了类似于 Query Projection (Link to the Docs) 的内容。这是我用来从数据存储区获取所有实体的代码。
def do_the_query_projection(self, kind_name):
query = self.client.query(kind=kind_name)
query.projection = ['attr_1', 'attr_2', 'attr_3']
#create a list to store
f, m, r = [], [], []
for task in query.fetch():
f.append(task['attr_1'])
m.append(task['attr_2'])
r.append(task['attr_3'])
return f, m, r
这是我现在面临的错误
> google.api_core.exceptions.FailedPrecondition: 400 no matching index
> found. recommended index is:
> - kind: <kind_name> properties:
> - name: attr_1
> - name: attr_2
> - name: attr_3
还有其他方法可以从 Cloud Datastore 中检索所有数据实体吗?我们是否需要创建复合索引来检索数据?我是 GCP 的新手。
【问题讨论】:
标签: python-3.x google-cloud-platform google-cloud-datastore