Search code snippets, questions, articles... Chrome Extension

Applying Left Outer Join query in SQLAlchemy

You can apply outer join in SQLAlchemy using the outerjoin() method and then applying the condition on which column basis it will be joined with another table.
    and_( == UserContactModel.user_id, == 'india'
).filter(UserModel.role == 'user').all()
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

In the code example, we are joining two tables user and user_contact. We are using the outerjoin() method for this purpose and based on user id we are joining them.

Was this helpful?
Join Devsheet Ask a Question