Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have been in a similar situation. Instead of ReferenceProperty, I had parent/child relationships but the basics are the same. My current solution is not polished but at least it is efficient enough for reports and things with 200-1,000 entities, each with several subsequent child entities that require fetching.</p> <p>You can manually search for data in batches and set it if you want.</p> <pre><code># Given the posts, fetches all the data the template will need # with just 2 key-only loads from the datastore. posts = get_the_posts() author_keys = [Post.author.get_value_for_datastore(x) for x in posts] authors = db.get(author_keys) city_keys = [Author.city.get_value_for_datastore(x) for x in authors] cities = db.get(city_keys) for post, author, city in zip(posts, authors, cities): post.author = author author.city = city </code></pre> <p>Now when you render the template, no additional queries or fetches will be done. It's rough around the edges but I could not live without this pattern I just described.</p> <p>Also you might consider validating that none of your entities are <code>None</code> because db.get() will return None if the key is bad. That is getting into just basic data validation though. Similarly, you need to retry db.get() if there is a timeout, etc.</p> <p>(Finally, I don't think memcache will work as a primary solution. Maybe as a secondary layer to speed up datastore calls, but you need to work well if memcache is empty. Also, Memcache has several quotas itself such as memcache calls and total data transferred. Overusing memcache is a great way to kill your app dead.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload