【发布时间】:2019-10-08 00:46:17
【问题描述】:
通过执行以下操作将以下数据添加到数据存储区:
key = ds.key(
'User', 'alice',
'id'
)
entity = datastore.Entity(
key=key,
)
entity.update({"data": "big amount of information"})
entity.update({"property_name": "confidential"})
ds.put(entity)
然后,为了减少资源使用,我尝试使用投影查询来仅获取小属性并通过执行以下操作忽略非常大的“数据”:
key = ds.key(
'User', 'alice'
)
query = ds.query(ancestor=key)
query.projection = ["property_name"]
entities = list()
for entity in query.fetch():
entities.append(entity)
return entities
但我收到此错误:
google.api_core.exceptions.InvalidArgument: 400 Unable to plan or invalidate query.
【问题讨论】:
标签: python google-cloud-datastore gcloud