Ticket #1319 (closed defect: fixed)
[PATCH] @paginate barfs if you try to sort on a column whose data is generated from SQL
|Reported by:||alastair||Owned by:||faide|
If you map against a select, you can generate columns (attributes) using SQL functions, for instance:
s = select([foo.c.name, func.count(foo.c.name).label('count')], group_by=[foo.c.name]).alias('statistics') class FooNameStatistics(object): pass m = mapper(FooNameStatistics, s)
If you then try to use this with @paginate, you'll find that trying to sort by the generated column doesn't work, because the code currently checks for sqlalchemy.schema.Column rather than sqlalchemy.sql.ColumnElement.
I've attached a patch that fixes this.
- Summary changed from @paginate barfs if you try to sort on a column whose data is generated from SQL to [PATCH] @paginate barfs if you try to sort on a column whose data is generated from SQL