subquery relationships?

36 views
Skip to first unread message

Dan Stromberg

unread,
May 31, 2023, 10:13:38 AM5/31/23
to 'Dan Stromberg' via sqlalchemy
Hi folks.

I have a subquery that is selected from a table with 5 foreign keys,
and joined with another table with 3 foreign keys.

And then that subquery is used in a join with the table having the 3
foreign keys again.

I don't know how to tell what column(s) that join is happening on.

What goes into SQLAlchemy's "thought process" when it joins a table
with a subquery?

Thanks!

Mike Bayer

unread,
May 31, 2023, 3:28:22 PM5/31/23
to noreply-spamdigest via sqlalchemy
docs for this are at:

https://docs.sqlalchemy.org/en/20/orm/join_conditions.html

there are several approaches to relationships with subqueries, the most open ended is the one described at https://docs.sqlalchemy.org/en/20/orm/join_conditions.html#relationship-to-aliased-class
> --
> 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+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/CAOvKW56oZPu4NByXY1qZO99T8BQ_L54w42y6cex9zJyEoPmejw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages