I\'m using sqlalchemy as my orm, and use declarative as Base.
Base = declarative_base()
class User(Base):
__tablename__ = \'users\'
id
\To see if user has been modified you can check if user in session.dirty. If it is and you want to undo it, you can execute
session.rollback()
but be advised that this will rollback everything for the session to the last session.commit().
If you want to get the original values and memory serves me correctly, it's the second element of the tuple returned by the sqlalchemy.orm.attributes.get_history utility function. You would have to do
old_value = sqlalchemy.orm.attributes.get_history(user, 'attribute')[2]
for each attribute that you want.