To put it more clear why: rows = session.query(*[func.count().over().label("count")]+map(lambda column: MyClass.__dict__[columns],columns)).filter(...).limit(n).offset(m).all() works and *rows = session.query(*[func.count().*
*over().label("count")]+map(**lambda column: MyClass.__dict__[columns],**columns)).filter(...).distinct().limit(n)**.offset(m).all()* does not? Thanks Am Mittwoch, 16. Mai 2012 12:07:26 UTC+2 schrieb Eduardo: > > Hello, > I have got a query of the following type: > > rows = session.query(*[func.count().over().label("count")]+map(lambda column: > MyClass.__dict__[columns],columns)).filter(...).limit(n).offset(m).all() > > it returns the number of results together with values of selected columns. > The problem is when I try to apply the distinct query I see that > func.count().over().label("count") does not return correct results, that is, > it returns the number of results for the query by which the distinct function > is omitted. > Is there any workaround for this problem? > The query contains no joins. > Thank you > ED > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/W80zRGtGptAJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.