I have a simple little \"Observation\" class:
from google.appengine.ext import ndb
class Observation(ndb.Model):
remote_id = ndb.StringProperty()
dimens
Silly me - all of these params need to sit within the query() function, not within fetch(). The projection elements actually works in fetch(), but you need to move both the projection and distinct arguments into query() to get it to work.
From Grouping:
Projection queries can use the
distinct
keyword to ensure that only completely unique results will be returned in a result set. This will only return the first result for entities which have the same values for the properties that are being projected.Article.query(projection=[Article.author], group_by=[Article.author]) Article.query(projection=[Article.author], distinct=True)
Both queries are equivalent and will produce each author's name only once.
Hope this helps anyone else with a similar problem :)