Coding with Python, I want to insert time processed on the database side like this:
time = func.now()-datetime.timedelta(days=100)
or
time = func.current_timestamp()-datetime.timedelta(days=100)
but somehow it couldn't get through, seeing warning:
sqlalchemy\engine\default.py:330: Warning: Truncated incorrect DOUBLE value: '1970-01-04 00:00:00'
Any way to get it straight? thanks.
================================
I want to update a TIMESTAMP column 'date_buy' in table 'Purchase', an d instead of using datetime.datetime.now() to get the update time in python, I want to get this done in the database, meaning I would prefer func.now():
time = func.current_timestamp()-datetime.timedelta(days=100)
# time = datetime.datetime.now()-datetime.timedelta(days=100)
session.execute(update(Purchase).values(date_buy=time).where(Purchase.c.id == 11))
=================================
solved. thanks to Bryan and his post: http://groups.google.com/group/sqlalchemy/browse_thread/thread/a67d4f179e01b98a/ee688a0b8a999f52?hl=en&lnk=gst&q=date_add#ee688a0b8a999f52