What is a good way to retrieve a reference object on each item of a list from datastore in Django on Google App Engine?

It happens because of the number of the RPC calls happening in the reference property. You should prefetch reference property to overcome the RPC overhead. I am not sure how to do prefetching of reference property in django-nonrel.

Have a look at this blog by Nick. This explains how to overcome reference property RPC overhead in appengine. In django-nonrel you should figure it yourself.

Thanks Abdul. It`s very helpful to know how google app engine app should handle this case. I`ll try to figure out how to achieve it on Django nonrel later.

– Yoo Matsuo May 24 at 13:02.

I've struggled to find a way of get_value_from_datastore in Django-Nonrel as Abdul said for a few days. But no luck. So I finally asked @wkornewald at Twitter, then he pointed me to use model.

_id. Now, I ported Nick's solution to Django-nonrel. I'm relatively new to Python, so this might not be good coding, but works as I expect.

Def prefetch_refprop(entities, prop_id, prop, filter): ref_ids = getattr(x, prop_id) for x in entities ref_entities = dict((x. Id, x) for x in filter(id__in=ref_ids)) for entity, ref_id in zip(entities, ref_ids): setattr(entity, prop, ref_entitiesref_id) return entities #Usage books = Book.objects. Filter(...) prefetch_refprop(books, 'author_id', 'author', getattr(Author.

Objects, 'filter')) Thanks everyone. Yoo.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions