I have a model like this:
class DetailStuff(db.Model):
lots of properties
class TopLevelStuff(db.Model):
lots of properties
detail = db.ReferenceProperty(DetailStuff)
Usually I just deal with the top level stuff when I'm doing broad queries.
When drilling down to learn about a particular object, I reference the detail
stuff. The magic of the reference property fetches the details, without me
having to worry about it.
That works great.
However, I now need to do a broad query that needs the details on every object.
If I fetch the TopLevelStuff objects in one query, then when I look at the
.detail member of each, it's going to do a single query to the datastore.
That's bad, since I'm going to iterate over a whole mess of the top level
objects.
I just optimized this by building a list of detail.get_value_for_datastore
values, doing a bulk get, and then going back and stuffing the detail data into
the top level objects (not as properties, but just attributes of the objects I
fetched) so I could do my processing.
That works, but it's a mess.
What I'd like is a way to ask the datastore to go fetch the objects referenced
by a LIST of objects as a bulk query. Then I could iterate over the top level
objects, and the details would all be there ready to go.
Is there a way to do this now?
If not, perhaps we could ask google to add something like this? Any
suggestions on the API?
TopLevelStuff.detail.get_all(list_of_top_level_stuff_objects) or something like
that?
-Joshua
--
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.