The Google Datastore adapter doesn't use GQL but instead uses the Python NDB datastore API. I think you can add the distinct=True argument to the .query() method (at least for projection queries), so you might try subclassing pydal.adapters.google_adapters.GoogleDatastoreAdapter and customize its .select_raw method to allow use of the "distinct" argument.
Anthony On Monday, October 26, 2015 at 7:47:44 AM UTC-4, Carl Hunter Roach wrote: > > Here's my Web2py-driven Python: > > db = current.db > rows = db().select(db.person.name, distinct=db.person.name) > for row in rows: > logging.info('name: %s' % row.name) > > This logs all rows from person, listing many duplicate name values. > > The equivalent GQL I've tried is: > > rows = gqldb.GqlQuery("SELECT DISTINCT iso31661 FROM geoPt") > for row in rows: > logging.info(row._entity['iso31661']) > > and this lists each unique name once. > > If I have 1,000 rows with 10 unique names then the the first example logs > 1,000 names and the GQL example, 10. > > Can anyone help? > > > On Monday, 26 October 2015 10:57:53 UTC, Carl Hunter Roach wrote: >> >> Google slipped in support for DISTINCT in its GQL SELECT in 2013. >> >> Are there any plans to add this to the DAL? >> >> Ref: https://cloud.google.com/datastore/docs/apis/gql/gql_reference >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.