Re: onupdate not working with postgresql

210 views
Skip to first unread message

Kartik Lakhotia

unread,
Jul 1, 2011, 6:21:59 PM7/1/11
to sqlal...@googlegroups.com
Sorry, i left a half finished message by mistake.
I have described a column as :
 
     updated = Column(DateTime, onupdate = datetime.datetime.now())

But it leaves the field value null when any row is updated. I have also tried using func.current_Timestamp but that doesnt work either.

Moodi

unread,
Jul 1, 2011, 7:36:37 PM7/1/11
to sqlal...@googlegroups.com
I too faced a similar problem. Spent a lot of time just to figure out that -

These update functions do not work when you try to update the table directly from database. And actually they should not, as postgres does not provide such feature in its database

When I tried updating from sqlalchemy session - things worked for me. SQLalchemy has already implemented the required triggers for auto updation. May be its the same problem for you.



Kartik Lakhotia

unread,
Jul 2, 2011, 7:58:17 AM7/2/11
to sqlal...@googlegroups.com
It was exactly da same problem i was facing..
Thaks a lot moodi. I got dis now
Reply all
Reply to author
Forward
0 new messages