How to query two tables to get data from either of them that's distinct from another?

Question:

I need to get left join results from two tables table1 and table2.

My SQL query gives me the desired result.

select *
from table1 left join table2
on table1.name=table2.name where table2.name is null;

How do I turn this into a Flask SQLAlchemy query?

Asked By: Almett

||

Answers:

A.join(B, A.id==B.id, isouter=True)

Answered By: Hariomsuryvanshi

Can be something like that:

db.session.query(A).outerjoin(B, A.name == B.name).filter(B.name == None)
Answered By: Rasim Mammadov
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.