is it possible to aggregate table rows to a single list in a select statement in SQLalchemy.
Guess we have Table1, Table2, Table3. We have “id” shared between the tables. I know that “id” is the primary key for Table1 and Table2, but a foreign key in Table3. I would like to have a statement like this:
(select(Table1, Table2, <Aggregate Table3 to list> )
.join(Table2, onclause=Table2.id == Table1.id, full=True)
.join(Table3, onclause=Table3.id == Table1.id, full=True)
.group_by(Table1.id)
.where(Table1.id==<id-of-interest>))
The result should be single row containing the columns of Table1, Table2 and a single column with the aggregated list. Any help is appreciated.