'how to convert sql query to sqlalchemy in python fatsapi
SELECT * FROM order_trade join credential as buyer on buyer.user_id = order_trade.buyer_id join credential as seller on seller.user_id = order_trade.seller_id;
Solution 1:[1]
as ORM go for
session.query(order_trade).filter(order_trade.buyer_id=buyer.user_id).first()
or plain query
conn.execute("SELECT * FROM order_trade as ot,buyer as b where order_trade.buyer.id = b.user_id") # this is simple query
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ashkan Goleh Pour |