Hm. I appreciate the help, but something is clearly still failing here. > session.query(Route,*sq.c).join(sq.c.max_hop) ArgumentError: Can't find any foreign key relationships between 'route' and 'max_hop'
Maybe the filter based solution is just fine here :) On Thu, Jul 23, 2009 at 7:29 PM, Michael Bayer<mike...@zzzcomputing.com> wrote: > > > On Jul 23, 2009, at 5:20 PM, Gregg Lind wrote: > >> >> How do I implement this join? If I do this: >> >> sq = >> session >> .query >> (Route >> .ts >> ,Route >> .startpoint,Route.target,func.max(Route.hop_id).label('max_hop')) >> sq = sq.group_by(Route.ts,Route.startpoint,Route.target).subquery() >> >> then: >> >> q = session.Query(Route,*sq.c).join(???) >> >> What would that join be on? Hop_id isn't in the subquery. >> > > sq.c.max_hop > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---