its an 0.5 paradigm.  in 0.4 you do the more manual practice of  
selecting from joins you create with the expression language:

query(X).select_from( table1.outerjoin(table2,  
and_(table1.c.foo==table2.c.bar, table2.c.x=='y')) )



On Jan 8, 2009, at 3:41 AM, ml wrote:

>
> this is what I'm looking for but it doesn't work in 0.4.8. 0.5 is  
> fine?
>
> Michael Bayer napsal(a):
>> 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