GAE datastore eager loading in python api
- by tomus
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 ?