On Jun 19, 2011, at 6:16 PM, Filip Zyzniewski - Tefnet wrote:

> Hi,
> 
> another day and another challenge :).
> 
> Somehow SQLAlchemy has a problem determining what to join when using 
> concatenation of columns.
> 
> this: session.query(Locality.name, Street.name).join(Street.locality)
> properly joins:
> FROM street JOIN locality ON street."localityId" = locality."Id" 
> 
> but this: session.query(Locality.name + ' ' + 
> Street.name).join(Street.locality)
> 
> does: FROM street, locality JOIN locality ON street."localityId" = 
> locality."Id"

that one is a little unfortunate but can be fixed with a small push:

q = session.query(Locality.name + ' ' + Street.name)
q = q.select_from(Street).join(Street.locality).filter(    Locality.name == 
'Southpark')
print q.all()

again i'd like to check why its coming up with an answer that bad otherwise





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

Reply via email to