Not sure on this one, but are you passing a formatted date string? Maybe you should set a datetime object directly and let SA do the string conversion during flush.
Alex
Sent from my fantastic HTC Hero
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to sqlal...@googlegroups.com.
To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
any value that you send explicitly for the column during an update overrides the "onupdate" value. Below is a test case which illustrates this:
from sqlalchemy import *
import datetime
e = create_engine('sqlite://', echo=True)
m = MetaData()
t = Table('t', m,
Column('id', Integer, primary_key=True),
Column('modified', DateTime(),
default=datetime.datetime.now,
onupdate=datetime.datetime.now
)
)
m.create_all(e)
old_date = datetime.datetime(2009, 10, 15, 15, 45, 0)
e.execute(t.insert().values(id=1))
e.execute(t.insert().values(id=2))
e.execute(t.insert().values(id=3, modified=old_date))
e.execute(t.update().where(t.c.id==2).values(modified=old_date))
assert e.execute(
select([t.c.id]).
order_by(t.c.id).
where(t.c.modified==old_date)
).fetchall() == [(2, ), (3, )]
>
> Thanks for your help,
> Stephane
>