Search code examples
pythongoogle-app-enginegqlgqlquery

How to GROUP BY in App Engine


Is there some way to GROUP BY in App Engine, via GQL or Query methods?

I made some research and I've read that there isn't GROUP BY in GQL, and looks like there isn't also in Query class.

If is there any resource or any approach to implement with Python, please let me know.


EDIT

I've read also that its possible to make a GROUP BY with Map Reduce. If anyone has experience with this, a help would be accepted.

Thanks.


Solution

  • No, the datastore does not support any kind of database-side processing or aggregation. The solution is to do all post processing in memory. The two ways to do that are in each request, or with map reduce. Either solution will always return all rows in your query, but how you get the rows varies.