mix of multiple joins and multiple tables and multiple columns in python orm
query_result = session.query(models.Table1.col1.label('table1_col1'),
models.Table1.col2.label('table1_col2'),
models.Table2.col3.label('table2_col3'),
models.Table2.col4.label('table2_col4'),
models.Table3.col5.label('table3_col5'),
models.Table3.col6.label('table3_col6'),
models.Table4.col7.label('table4_col7'),
models.Table5.col8.label('table5_col8')).join(
models.Table6, and_(models.Table6.<col>==models.Table2.<col>,
models.Table2.<col>.in_(<list_of_values>)), isouter=False).join(
models.Table1, models.Table1.<col>==models.Table6.<col>, isouter=False).join(
models.Table3, and_(models.Table3.<col>==models.Table2.<col>,
models.Table3.<col>==models.Table1.<col>), isouter=False).join(
models.Table4, models.Table4.<col>==models.Table3.<col>,
isouter=True).join(models.Table5,models.Table5.<col>==models.Table3.<col>,
isouter=True)
result = list(set(query_result.all()))