Closed mkagenius closed 3 years ago
Hmm, never used that function. Not sure what the initial intentions were, but it does not make much sense to me. Neither I have postgres instance to play with. I will probably remove this functionality in the future
Hi, I'm dropping support of this feature in favor of improving features that are defined by JSON API standard. 'group' is not one of them, it seems confusing and is currently broken.
It is going to be removed in version 2.x
(beta is already available)
I'm sorry if that is not the solution you were hoping for.
If you do find this feature valuable - please free to file a feature request.
This feature of group by documented here https://flask-restless-ng.readthedocs.io/en/latest/fetching.html#sorting doesn't work at all, may be because of the way query is being constructed for the newer versions of postgres
API call:
127.0.0.1:5000/api/users?group=state
group
parameter creates a sql query like:SELECT users.id AS users_id .. FROM users GROUP BY users.state ORDER BY users.id ASC LIMIT %(param_1)s OFFSET %(param_2)s
which is obviously wrong, as one cannot expect one users.id being returned in every group (grouped using state)
And ofcourse the API throws the error:
(psycopg2.errors.GroupingError) column \"users.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1
So, whats the solution?