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

On Oct 28, 2010 1:41 AM, "KLEIN Stéphane" <klein.steph...@gmail.com> wrote:

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<sqlalchemy%2bunsubscr...@googlegroups.com>
.
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.

-- 
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