you're trying to tell the database to execute a piece of python code. What you should do is either craft a backend-specific query, OR fetch the "start" value, compute + timedelta(hours=1), update "start".
On Friday, November 20, 2015 at 7:52:05 AM UTC+1, mfarees...@gmail.com wrote: > > I have a table that I have created (in models) using > > db.define_table('myTable', > Field('start', type='datetime', requires=NE) > ) > > I have some records in this table, in this format: '2015-12-31 00:00:00' > (this is on id = 1) > > > I want to run a query that will add one hour to this time, for each row. > > > db(db.myTable.id == 1).update(start = db.myTable.start + timedelta(hours=1)) > > > But when I execute the above query, it changes the start value to '2015-12-31 > 00:00:01'. And if I run the same query again it changes it to '0000-00-00 > 00:00:00'. What am I doing wrong here and how can I fix this? > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.