[sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Kent
Is there a simple way to revert all columns back to their committed state (some columns may be synonyms), or do I need to loop through mapper.iterate_properties, get the ColumnProperty ones, make sure they aren't aliases (prop.columns[0] is Column) and use setattr() to set the value back to the

Re: [sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Michael Bayer
If you're trying to avoid doing a SQL round trip then yeah there's no API for a revert within the attribute itself, we tried going down that road when we started doing 0.5 and quickly ran into all kinds of edge cases that didn't really work out, so we decided to just keep it simple and let the

Re: [sqlalchemy] most straightforward way to revert some column changes

2012-02-28 Thread Michael Bayer
oh also you might want to use attributes.set_committed_state instead of setattr() so that the history is cleared. On Feb 28, 2012, at 4:08 PM, Kent wrote: Is there a simple way to revert all columns back to their committed state (some columns may be synonyms), or do I need to loop through