我仍然对 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 中转换的。