Answering my own question here...

father = Father.all().filter("name =", "John").get()
father.name = "Doe"
sons = father.son_set.fetch(1000)
print sons[0].father.name  #prints 'John'

Maybe I'm just used to more 'traditional' ORM systems, but that seems
to me unintuitive.  Not too mention inefficient.  Since Google is so
concerned with performance, you'd think they would have built-in some
sort of level 1 cache for entities.  Oh well...

And I'd still like to be able to have a datastore access log.

Jeff


On Oct 11, 4:29 pm, Jeff Nichols <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Say I have a one-to-many relationship between 'Father' and 'Son'
> modeled with a reference property on the Son entity.  After fetching
> all sons of a father, are the father references of those sons
> prepopulated, or will they also be fetched?  Illustrated in code...
>
> class Father(db.Model):
>   name = db.StringProperty()
>
> class Son(db.Model):
>   father = db.ReferenceProperty(Father)
>
> father = Father.get_by_key_name(some_key)  # DataStore access
> sons = father.son_set.fetch(1000)  # DataStore access
> for son in sons:
>   logging.info(son.father.name)  # DataStore access???
>
> On a side note, I could figure this out myself if there were some way
> to log datastore access.  Have I looked over some way to enabled this
> sort of logging?
>
> Thanks,
> Jeff
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to