【发布时间】:2015-08-08 04:16:43
【问题描述】:
我正在设计一个要存储在 Google Datastore 中的数据结构。
- 应用程序有类别
- 类别具有其他属性
我喜欢查询属于特定类别的所有应用程序 我还想获得给定类别中应用程序数量的总和。
为了实现这一点,我设计了以下类。
application.py
from google.appengine.ext import ndb
from cfc.models.admin.applicationcategory import ApplicationCategory
class Application(ndb.model):
""" Application Model"""
name = ndb.StringProperty()
category = ApplicationCategory()
applicationcategory.py
from google.appengine.ext import ndb
class ApplicationCategory(ndb.model):
"""Models an application Category"""
name = ndb.StringProperty()
date_created = ndb.DateTimeProperty(auto_now_add=True)
我的问题是如何定义查询,因为数据存储最终是一致的?
【问题讨论】:
-
阅读有关使用父母重新:最终一致性的信息。除此之外,这个问题缺乏很多信息来给你建议。
标签: python google-app-engine google-cloud-datastore