[sqlalchemy] Re: SelectResults, counts and one-to-many relationships

2007-02-06 Thread King Simon-NFHD78
Michael Bayer wrote: I added distinct() to selectresults as a method and made the unit test a little clearer (since i dont like relying on the selectresults mod)... q = sess.query(Department) d = SelectResults(q) d =

[sqlalchemy] Re: SelectResults, counts and one-to-many relationships

2007-02-05 Thread Michael Bayer
the non-distinct parts of this test fail on postgres, because its not doing the nesting thing: sqlalchemy.exceptions.SQLError: (ProgrammingError) column departments.name must appear in the GROUP BY clause or be used in an aggregate function 'SELECT count(departments.department_id) \nFROM

[sqlalchemy] Re: SelectResults, counts and one-to-many relationships

2007-02-05 Thread Michael Bayer
I added distinct() to selectresults as a method and made the unit test a little clearer (since i dont like relying on the selectresults mod)... q = sess.query(Department) d = SelectResults(q) d = d.join_to('employees').filter(Employee.c.name.startswith('J')) d =