Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top