Re: [sqlalchemy] subquery relationships?

2023-05-31 Thread Mike Bayer
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



On Wed, May 31, 2023, at 10:13 AM, Dan Stromberg wrote:
> 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!
>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/CAOvKW56oZPu4NByXY1qZO99T8BQ_L54w42y6cex9zJyEoPmejw%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/4bf74f30-bb42-43b7-a0a1-98ebb4c58a02%40app.fastmail.com.


[sqlalchemy] subquery relationships?

2023-05-31 Thread Dan Stromberg
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!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAOvKW56oZPu4NByXY1qZO99T8BQ_L54w42y6cex9zJyEoPmejw%40mail.gmail.com.