do you perhaps mean to say,   query(Sortment).outerjoin((Translation,  
and_(Sortiment.id==Translation.sortiment_id,  
Translation.langauge=='en'))) ?


On Jan 7, 2009, at 4:04 PM, ml wrote:

>
> That is a solution but it is not very efficient. It involves a
> sequential scanning of the result of the join inside the database.
>
>
> Michael Bayer napsal(a):
>>
>> On Jan 7, 2009, at 11:49 AM, ml wrote:
>>
>>> Hi!
>>>
>>> I have 2 tables:
>>>
>>> sortiment(id, ...) <---- translations(id, id_sortiment, language,
>>> text)
>>>
>>> The query
>>>
>>> query
>>> (Sortiment
>>> ).outerjoin 
>>> (Sortiment.translations).filter(Translation.language="en")
>>>
>>> will never return sortiment item with missing "en" translation  
>>> because
>>> the filter (useless outerjoin). I need the Translation.language="en"
>>> embed into the outerjoin but the language must be variable. This  
>>> is a
>>> general problem of creating variable joins on session queries.
>>> Is there any simple way?
>>>
>>
>> you'd filter on or_(Translation.language=="en",
>> Translation.language==None)
>>
>
> >


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