On Jul 11, 2010, at 5:40 AM, Daniel wrote:

> 
>>> 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?

we use lowercase with underscores for all names, but the underscores aren't 
applied to words that colloquially tend to be one word like "outerjoin".

> 
> 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'".

well in that last example subquery is not a Query() object, its an Alias 
construct.  It has a different API and you should work through the SQL 
Expression Tutorial to get a feel for expression constructs.   It probably 
shouldn't be making a text() construct out of a tuple, though.   ticket 1847




> 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.
> 

-- 
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.

Reply via email to