In the python version of Google App Engine, how do I find the quartile values of a model with an index on a specific property?

StackOverflow https://stackoverflow.com/questions/7398771

  •  29-10-2019
  •  | 
  •  

Question

In Google App Engine I have a model with 10K entities with an index on the property foo. What is the most efficient way to find the 1st quartile, 2nd quartile (the median), and the 3rd quartile entities? I can fetch the sorted list of keys and find the three quartile keys programmatically, but downloading all the keys won't scale. What is the more elegant approach?

sortedValues = MyModel.all(keys_only=True).order('foo').fetch(limit=10000)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top