[sqlalchemy] Updating attributes of an instance

2010-10-07 Thread Alok G. Singh
Is there an elegant way of replacing all the attributes of an instance, except the primary key ? Currently, I create a new object with all the date, fetch the old object and do for k,v in new: old.__setattr__(k, v), taking care to skip the primary key attribute. There's a custom __iter__ method

Re: [sqlalchemy] Updating attributes of an instance

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 5:37 AM, Alok G. Singh wrote: Is there an elegant way of replacing all the attributes of an instance, except the primary key ? Currently, I create a new object with all the date, fetch the old object and do for k,v in new: old.__setattr__(k, v), taking care to skip the