Well yes I could add a count property to the B objects, but I'm really
trying to understand more about how ReferenceProperty works.

Nonetheless, there are a couple reasons I don't want to add a count
property to the B objects:

  -- Every time I create or delete an A object, I would also have to
make two additional datastore calls to read, modify, and write object
B.

  -- And to make sure the counter stays in sync, I would need to use a
datastore transaction for these operations. But right now, my A and B
objects are not in the same entity group, which means (if I understand
correctly) transactions are not supported. So I would have to do a
full update to the existing datastore in order to add a reliable
counter to object B.




On Jun 21, 12:31 pm, Sylvain <[email protected]> wrote:
> Could you add an int property that is updated with the len ?
> So you only check this property ?
>
> On 21 juin, 17:51, johntray <[email protected]> wrote:
>
>
>
> > If I have two datastore object types, I'll call A and B, and A
> > includes a ReferenceProperty to B, then objects of type B will have a
> > back-reference property with default name a_set. Now if I just want
> > the size of some B object's a_set, I could call len(a_set). To execute
> > this, my understanding is that GAE will do a datastore query to
> > retrieve the relevant A objects and pass them to the len() function.
> > Since I don't need the A object contents, would it be more efficient
> > to set up my own Query object and call Query.count() instead?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to