[sqlalchemy] Using count and distinct with window function

2012-05-16 Thread 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

[sqlalchemy] Using count with distinct?

2009-02-02 Thread Stuart Axon
I've got a fairly simple query in postgres... any idea how I do this in sqlalchemy - I couldn't find any info about this select count(distinct device_id) from externalbuild join build on build.id = externalbuild.build_id where external_id = '1' and not is_known BTW,