sqlalchemy filter by comparing datetime.now() and column default date
I doubt that (datetime.now() - datetime.now()).days
works since datetime.datetime
instance only have attribute named day
rather than days
. Using datetime.now().days
would result in AttributeError: 'datetime.datetime' object has no attribute 'days'
You might try this:
from datetime import timedelta
res = session.query(Object).filter(
(Object.created_date+timedelta(days=1))>datetime.now())