Explicit Joins in SQLAlchemy

    0

    0

    Huang Brandon

    The code above will return a list of tuples, where each tuple will have the following structure:

    (table_a_col, join_result)

    join_results = (
        db.session.query(TableA).filter_by(table_a_col=some_var)
          .join(TableB, TableB.table_a_id == TableA.id)
          .all()
      )
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.