class Parent:
    name = db.StringProperty()

class Child
    parent = db.ReferenceProperty (reference_class=Parent)

p = Parent.get()

q = Child.all()
q.filter ("parent =", p.key())
children = q.fetch(100)
children[0].parent.name # will this cause another call to get() on Parent ?

In the above example, will the accessing the parent.name attribute on one of the children cause a parent to be re-fetched - or all children's parent is point to 'p' ?

Hope this clear and appreciate any help..

Thanks.

有帮助吗?

解决方案

Yes it will cause the parent to be refetched.

There is no implicit caching when using db.

ndb which does have caching, would potentially fetch the parent as you don't have a reference property and you need to perform an explicit get on a KeyProperty.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top