Comment 9 for bug 2037107

Revision history for this message
Max (maxlamprecht) wrote :

Addition to #8:

The sqlalchemy docs says:
"The joins produced by joinedload() are anonymously aliased. The criteria by which the join proceeds cannot be modified, nor can the ORM-enabled Select or legacy Query refer to these joins in any way, including ordering" [1]

I guess ordering or grouping is the same here.
Since we use in the orm model lazy=joined which is the joinedload() option the group_by will not work for the joined tables.

Same issue on stackoverflow -> [2]

[1] https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html
[2] https://stackoverflow.com/questions/28763372/sqlalchemy-group-by-after-joinloaded