python - Get only the keys out of a reference property in GAE-Py -
i've got app i'm storing posts , authors. straightforward each post has 1 author model.
the problem this: fetch last 10 posts using 1 call, using fetch() limit = 10. when print them out, gae uses 10 gets access author details, because author object reference property on post... classic n+1 query scenario - 1 query 10 posts , 10 queries each author.
is there way can iterate on posts collect author object keys, can load them @ 1 go using
db.get(all_author_keys)
see response this question couple hours ago -- q identical amazing coincidence one, though different poster.
in short, this, use get_value_for_datastore
of property
object.
Comments
Post a Comment