How do I compare a DateTime column to now() in a query filter in SqlAlchemy?
Posted
by Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-06-09T21:58:01Z
Indexed on
2010/06/09
22:02 UTC
Read the original article
Hit count: 170
I have a table with an 'expires' datetime column. I want to find all the items that have an 'expires' date earlier than now.
I've tried
session.query(Item).filter(Item.expires < now())
but it doesn't return anything regardless of the dates in the table. I'm using PostgreSQL 8.4.
How do I do this comparison?
© Stack Overflow or respective owner