I've written the following SQLAlchemy query:
db.get_session().query(Order, Order.created, Order.symbol).filter(Order.symbol=='GE').all()
Which produces an output like this:
What I'm trying to do is is get the ones where Order.created == '2017-02-03'
.
I've tried db.get_session().query(Order, Order.created, Order.symbol).filter(Order.symbol=='GE').filter(Order.created=='2017-02-03').all()
but it doesn't work (no result).
What am I doing wrong?
Solved it using func.date()
from sqlalchemy import func
db.get_session().query(Order, Order.created, Order.symbol).filter(func.date(Order.created) == '2017-02-03').all()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.