Left join with python-sql

20 views
Skip to first unread message

paul...@alephd.com

unread,
Apr 5, 2016, 7:05:04 AM4/5/16
to python-sql
Hi there, 
thank you for your library. I'm trying to perform a left join with python-sql but I don't find a command to do it.
I tried with

query_delta

    query = Table.join(query_delta)
    query.condition = query.left.id == query_delta.id

Sergi Almacellas Abellana

unread,
Apr 5, 2016, 5:33:07 PM4/5/16
to pytho...@googlegroups.com
El 05/04/16 a les 11:47, paul...@alephd.com ha escrit:
You must join two table objects, and use the condition argument on the
join function:

a = Table('table_a')
b = Table('table_b')

And then use the type_ parameter to indicate the join type (by default
it uses a INNER join)

a.join(b, type_='LEFT', condition=(a.id == b.relate_id)

Hope it helps!



--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

paul...@alephd.com

unread,
Apr 6, 2016, 9:00:04 AM4/6/16
to python-sql
My message has been sent until I finished it :)

Thank you for the answer, I was looking for the type_="LEFT"
Reply all
Reply to author
Forward
0 new messages