Skip to content
Advertisement

RIGHT OUTER JOIN in SQLAlchemy

I have two tables beard and moustache defined below:

I have created a SQL Query in PostgreSQL which will combine these two tables and generate following result:

Query:

However I can not create SQLAlchemy representation of it. I tried several ways from implementing from_statement to outerjoin but none of them really worked. Can anyone help me with it?

Advertisement

Answer

From @Francis P‘s suggestion I came up with this snippet:

However this works but you can’t call it as an answer because it appears as a hack. This is one more reason why there should be RIGHT OUTER JOIN in sqlalchemy.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement