dai*_*yue 3 google-app-engine python-3.x google-cloud-datastore
我想知道如何检索存储在所有种类的名称google cloud datastore
中Python
。我正在考虑使用一个query
,
client = datastore.Client()
query = client.query()
results = query.fetch()
Run Code Online (Sandbox Code Playgroud)
但它只获取默认存储的所有实体client
。那么在这种情况下如何获得所有种类的名称呢?
您可以使用种类元数据查询来获取种类名称。
如果您使用的是 Google Cloud Python 库,它看起来像:
query = client.query(kind='__kind__')
query.keys_only()
kinds = [entity.key.id_or_name for entity in query.fetch()]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1352 次 |
最近记录: |