标签: sqlalchemy
我有模型成本和利润。目标是通过1个DB请求获得两个表中元素的计数。
在SQL中我可以这样做:
SELECT SUM(d1.c1) FROM (SELECT count(id) as c1 FROM cost UNION SELECT count(id) as c1 FROM profit) as d1;
我如何在SQLAlchemy中做同样的事情?