The problem I was encountering is that history doesn't make it easy to differentiate between collections and non-collections very well:
inspect(obj).attrs.intcolumn.history.unchanged returns return [intval], rather than intval. inspect(obj).attrs.children.history.unchanged returns [<childobj>] It'd be handy if I can just do something like: original = get_original(self) if original.value != self.value: pass With some sufficiently-robust-but-should-be-simple implementation of get_history. The main problem with Jonathan's approach is the results will be inconsistent if any of the attributes are collections. In my actual case at the moment, I know every attribute I'm going to look at is a scalar, so inspect(self).attrs.target_attribute.non_added()[0] "works" (provided this was loaded from the database at all and isn't a new instance of the model). The problem is that I can't make easily write a general case for this, because the [0] is required for scalars, but will completely break when applied to any attribute that's a collection. Michael: By "Losing changes", I mean that I know it's easily possible to get to the unmodified version of an object via session.rollback() or session.expire() -- but then I lose the pending (not yet committed) changes that I'm trying to compare against. I wasn't referring to autoflush. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.