SQLAlchemy がどのように機能するかについては、まだ混乱しています。今のところ、次のようなクエリがあります
SELECT cast(a.product_id as bigint) id, cast(count(a.product_id) as bigint) itemsSold, cast(b.product_name as character varying)
from transaction_details a
left join product b
on a.product_id = b.product_id
group by a.product_id, b.product_name
order by itemsSold desc;
これがFlaskでどのように変換されるかはよくわかりません。