I want to do something like this:
select ticket.*, (select count(*) from ticket_changes where
ticket_changes.ticket = ticket.id) as count
from ticket
at the ORM layer. My best stab at it was
>>> subquery = select([func.count('*').label('count')], from_obj=ticket_changes)
>>> session.query(Ticket, subquery.c.count).join(subquery).all()
but, .join seems to want to do an actual join in the FROM clause, and
I just want it to go into the SELECT clause as a correlated subq. The
docs don't have any examples of a correlated subquery from the ORM so
I'm starting to think maybe this isn't possible yet.
-Jonathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---