DEV Community

Vincent Engelmann
Vincent Engelmann

Posted on

2 1

Explicit Joins in SQLAlchemy

Explicit joins in SQLAlchemy! What this means is that we are showing what the join conditions are within the ORM query itself, rather than built into your model classes.

Here's the ORM query with explicit joins:

    join_results = (
        db.session.query(TableA).filter_by(table_a_col=some_var)
            .join(TableB, TableB.table_a_id == TableA.id)
            .all()
    )

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay