[sqlalchemy] Re: setattr and mapped ORM

2009-10-24 Thread laurent FRANCOIS
On Wed, 2009-10-21 at 09:24 -0700, David Gardner wrote: > Using setattr() shouldn't be a problem, however the __dict__ attribute > also has other things in there like _sa_instance_state that I don't > believe you > want to copy to the new item. Try this instead: > > for col in object_mapper(upda

[sqlalchemy] Re: setattr and mapped ORM

2009-10-23 Thread laurent FRANCOIS
On Wed, 2009-10-21 at 09:24 -0700, David Gardner wrote: > Using setattr() shouldn't be a problem, however the __dict__ attribute > also has other things in there like _sa_instance_state that I don't > believe you > want to copy to the new item. Try this instead: > > for col in object_mapper(upda

[sqlalchemy] Re: setattr and mapped ORM

2009-10-21 Thread David Gardner
Using setattr() shouldn't be a problem, however the __dict__ attribute also has other things in there like _sa_instance_state that I don't believe you want to copy to the new item. Try this instead: for col in object_mapper(update): setattr(proxy,col.key,getattr(update,col.key)) laurent FR