On Feb 28, 5:39 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> oh also you might want to use attributes.set_committed_state instead of 
> setattr() so that the history is cleared.
>

1) What do you mean? setattr() also clears the history if you set it
back to what it used to be... right?

2) yes, I meant not going back to database, so given I need to
manually reset them, is there a more elegant method than:

                for col in object_mapper(self).iterate_properties:
                    if type(col) is ColumnProperty and \
                       type(col.columns[0]) is Column:
                        ...
                        # find and set orig_value
                        ...
                        setattr(self, col.key, orig_value)

the mechanism I'm using to make sure I have a real column (not alias,
not RelationshipProperty) seem convoluted.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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