Re: [sqlalchemy] Problem writing a query with distinct

2012-10-24 Thread Ladislav Lenart
Hello. I haven't used distinct() yet, but if you modify your query: query = dbSession.query( Candidate )\ .join( Vote )\ .filter(\ model.core.Candidate.id == model.core.Vote.candidate_id , model.core.Vote.yay == True , )\ .order_by(\

[sqlalchemy] Problem writing a query with distinct

2012-10-23 Thread Jonathan Vanasco
I'm trying to write a query against Postgres and it's driving me a bit mad. Hoping someone here can help. I'm make the example in something topical... voting! Given: Candidate id name Vote id candidate_id (fkey on Candidate) yay (bool) With this