> > I've managed to fix it using sqalchemy.orm.outerjoin in conjunction > > with query's select_from function. Out of interest, why is the naming > > scheme different for these 2 functions? > > which two names/functions are you referring to ? >
outerjoin and select_from, one seems to be lower case, the other, lower case with underscores. Is this because one is a function and the other is a method? unfortunately this: query(Vote).outerjoin((Vote, subquery.c.max_id==Vote.id)) generates invalid SQL and this: query(Vote).outerjoin((subquery, subquery.c.max_id==Vote.id)) has the join backwards, as ordering counts. I was trying things like: subquery.outerjoin((Vote, subquery.c.max_id==Vote.id)) This generates the rather indecipherable error "AttributeError: '_TextClause' object has no attribute 'foreign_keys'". If you try doing the same query, but don't generate a subquery first the error is "Not unique table/alias: 'votes'". But as I say I found a workaround using the orm.outerjoin function, so this is rather academic from my perspective. Thanks, Daniel -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.