I've about 400+ model cases of a particular model ("Grade") during my datastore. Every one has an integer property known as "points" (points = db.IntegerProperty(default=)) with various values.
What's the easiest method to obtain a cumulative sum of all of the "points" values from each instance? It is possible to method of doing it without needing to retrieve all of the instances with Model.all()?
You can first perform a GQL query to obtain secrets of organizations which have the need for points > :
SELECT __key__ FROM Grade WHERE points > 0
By doing this you simply pull-up organizations that you'll require, and ignore any organizations that mathematically don't matter. Then, you are able to perform a loop in which you retrieve each entity you receive a key for by doing db.get(Key) for every key and adding points up to and including variable.
In GAE, queries that only get secrets tend to be more efficient and price less: http://code.google.com/appengine/docs/python/datastore/queries.html#Queries_on_Keys