如何在SqlAlchemy中执行“left outer join”。

20 浏览
0 Comments

如何在SqlAlchemy中执行“left outer join”。

我需要执行这个查询:

select field11, field12
from Table_1 t1
left outer join Table_2 t2 ON t2.tbl1_id = t1.tbl1_id
where t2.tbl2_id is null

我在Python中有这些类:

class Table1(Base):
   ....
class Table2(Base):
   table_id =  Column(
        Integer,
        ForeignKey('Table1.id', ondelete='CASCADE'),
    )
    ....

如何从下面的代码中获得上述结果?

0