Hi,

in my project, I use "onupdate" attribute :

foobar_table = Table("FooBar", meta.metadata,
...
    Column("created", DateTime(), default=datetime.datetime.now),
    Column("modified", DateTime(), default=datetime.datetime.now,
onupdate=datetime.datetime.now),
...
)

All work great.

However, my project have an importation feature and I need to set
original "modified" field value.

To do that, I've try this solution :

my_foobar_obj.modifield =
datetime.datetime.strptime(source_date_value, '%Y-%m-%d %H:%M:%S')
session.commit()

=> not success, "modified" field not contain "source_date_value" but
current date

Other solution :

foobar_table.update().\
                where(foobar_table.c.id==my_foobar_obj.id).\
 
values(modified=datetime.datetime.strptime(source_date_value, '%Y-%m-
%d %H:%M:%S'))

=> not success, "modified" field not contain "source_date_value" but
current date

Have you a tips to manually change "modified" field value ?

Thanks for your help,
Stephane

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to