我尝试在 SQLAlchemy (ORM) 中执行以下请求:
SELECT id, ref_prog FROM stepvand_1c_1t.equipment_day_hour WHERE id IN (SELECT id FROM stepvand_1c_1t.equipment WHERE equipment_type='L')
我做了:
subq = session.query(Equipment)
subq = subq.filter(Equipment.equipment_type == "L").subquery()
query = session.query(EquipmentDayHour)
query = query.filter(EquipmentDayHour.id.in_(subq))
但这不起作用...
Python 告诉我子请求的列太多。