GAE datastore eager loading in python api

Posted by tomus on Stack Overflow See other posts from Stack Overflow or by tomus
Published on 2010-01-20T01:15:03Z Indexed on 2010/04/24 16:03 UTC
Read the original article Hit count: 373

I have two models in relation one-to-many:

class Question(db.Model):

questionText = db.StringProperty(multiline=False)

class Answer(db.Model):

answerText = db.StringProperty(multiline=False)

question = db.ReferenceProperty(Question, collection_name='answers')

I have front-end implemented in Flex and use pyamf to load data.

When i try to load all answers with related questions all works as desired and I can access field

answer.question

however in case of loading questions (e.g. by Questions.all() ), 'question.answers' remains empty/null

(though on server/python side I can revise question.answers without problem - probably after lazy-loading).

So is it possible to load all questions along with answers ?

(I know this is possible in JPA Java api but what about python ?)

Shoud I use additional setting, GQL query or django framework to make it work ?

© Stack Overflow or respective owner

Related posts about python

Related posts about google-datastore