On Sun, Jun 21, 2009 at 7:33 PM, Paddy Foran <foran.pa...@gmail.com> wrote:

>
> Suppose I have the following database:
>
> class Model1(db.Model):
>  att1 = db.IntegerProperty()
>
> class Model2(db.Model):
>  model1 = db.ReferenceProperty(Model1, collection_name='model2s')
>  string = db.StringProperty()
>
> Suppose I create a few Model1s and several Model2s, then have the
> following code:
>
> model1s = Model1.all()
> for model1 in model1s:
>  for model2 in model1.model2s:
>    self.response.out.write(model2.string)
>
> Does model1.model2s cause a query to be run?


model1.model2s _is_ a query object. Iterating over it causes it to be
executed in the same manner that iterating over the model1s query object
causes that to be executed. No caching is performed, for the same reason.

-Nick Johnson

I would imagine so. Is
> this query run every time I ask for model1.model2s, or is it
> automatically cached?
>
> Any information on this would be helpful.
>
> Thanks,
> Paddy Foran
>
> >
>


-- 
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to