Google App Engine Query (not filter) for children of an entity

眉间皱痕 提交于 2019-12-03 03:30:39

Although ancestor is described as a "filter", it actually just updates the query to add the ancestor condition. You don't send a request to the datastore until you iterate over the query, so what you have will work fine.

One minor point though: 500 entities with the same parent can hurt scalability, since writes are serialized to members of an entity group. If you just want to track the factory that made a product, use a ReferenceProperty:

class Product(db.Model):
   factory = db.ReferenceProperty(Factory, collection_name="products")

You can then get all the products by using:

myFactory.products
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!