How can I use Google Cloud Datastore stats object (in Python ) to get the number of entities of one kind (i.e. Person) in my database satisfying a given constraint (i.e. age>20)?
Query objects have a nice
count method which you could use:
qry = Person.query(Person.age > 20) n_people_older_than_20 = qry.count()
Here I assume you're using the
ndb queries (i.e.
Person is an
ndb.Model subclass). I'm sure that there's an equivalent for the older
db interface as well ...