-1

I am trying to implement right join in sqlalchemy but did not find any appropriate solution.

I have tried the following::

=> is_outer = True (gives left outer join)

=> outerjoin

Ilja Everilä
  • 50,538
  • 7
  • 126
  • 127
  • `A RIGHT JOIN B` is equivalent with `B LEFT JOIN A`, so just swap the operands of your join and use `outerjoin()`, see https://stackoverflow.com/a/54350080/2681632 – Ilja Everilä Nov 15 '19 at 07:30
  • Possible duplicate of [RIGHT OUTER JOIN in SQLAlchemy](https://stackoverflow.com/questions/11400307/right-outer-join-in-sqlalchemy) – Jayant Sahewal Nov 15 '19 at 07:38

1 Answers1

3

Actually, right outer join does not exist in sqlAlchemy so you need to swap the table and use outer_join which is an alternate to right outer join. I hope it may help you.

query(Address).outerjoin(User, Address.id == User.address_id)

OR

query(User).select_entity_from(Address).join(User, isouter=True)
Azeem
  • 292
  • 2
  • 13