On Sep 11, 5:03 pm, Conor wrote:
> I believe what you want is:
> q = session.query(Option, func.count())
> q = q.outerjoin((option_senators, option_senators.c.option_id ==
> Option.id))
> q = q.group_by(Option.id)
> q = q.order_by(Option.name)
>
> which will generate this SQL:
> SELECT [...], c
I believe what you want is:
q = session.query(Option, func.count())
q = q.outerjoin((option_senators, option_senators.c.option_id ==
Option.id))
q = q.group_by(Option.id)
q = q.order_by(Option.name)
which will generate this SQL:
SELECT [...], count(*) AS count_1
FROM options LEFT OUTER JOIN optio