All, I am able to join two tables and get the desired result with the below SQL syntax; however, I am having trouble translating this SQL to the ORM join syntax. Any help will be appreciated.
SELECT * FROM raw.branch as b JOIN raw.bus AS bus1 ON bus1.id = b.id_from_bus AND bus1.id_model = b.id_model JOIN raw.bus AS bus2 ON bus2.id = b.id_to_bus AND bus2.id_model = b.id_model WHERE b.id_model = 10 AND b.ckt = '1' AND ((bus1.number = 510417 AND bus2.number = 547486) OR (bus2.number = 510417 AND bus1.number = 547486)) -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.