OK, not really, you want tables in the FROM clause. use either the
select_from() or join_from() method to do that:
https://docs.sqlalchemy.org/en/20/tutorial/data_select.html#explicit-from-clauses-and-joins
On Mon, Mar 20, 2023, at 5:16 PM, 'Dan Stromberg [External]' via sqlalchemy
wrote:
>
Here’s the select, and most of the from clause:
select nv.id, min(bs.build_id) as min_build_id
from tb_v as v,
tb_nv as nv,
tb_bs as bs,
tb_br as br,
From: 'Dan Stromberg [External]' via sqlalchemy
Date: Monday, March 20, 2023 at 2:16 PM
To: sqlalchemy@googlegroups.com
Subject: Re:
I’m getting some pushback internally, from my team lead – he and I both think
it’s probably too much detail to share. It’s 43 lines of SQL with multiple
subqueries.
Would just the simplest parts of the from clause work?
From: sqlalchemy@googlegroups.com on behalf of
Mike Bayer
Date:
what SQL are you going for ? start with that.
On Mon, Mar 20, 2023, at 10:33 AM, 'Dan Stromberg [External]' via sqlalchemy
wrote:
> That makes sense, but…. I’m afraid I don’t know how to add tb_br to the
> select.
>
> I tried:
> query = (
> select(NV.id, func.min(bs_3.build_id))
That makes sense, but…. I’m afraid I don’t know how to add tb_br to the select.
I tried:
query = (
select(NV.id, func.min(bs_3.build_id))
.select_from(bs, Br)
.join(v_2, onclause=(bs.version_id == v_2.id))
.join(bs_2, onclause=(Br.id == bs_2.branch_id))
)