I have been looking for a way to know what's going to be rolled back in SQLAlchemy so that I can know what was changed and restore other database unrelated things to their previous state.
By http://docs.sqlalchemy.org/en/latest/orm/events.html#session-events it looks like it's available an after_soft_rollback event, but in that even the objects already got rolled back and so their history is gone. In the most common scenario users do Session.flush() and then Session.rollback(), and in that case I have before_flush that can tell me everything that changed (than I can restore the state of related things into after_soft_rollback which can benefit from the knowledge that I gathered in before_flush) but if the user does a direct Session.rollback() without a flush I couldn't find an event I could attach to know what changed an so what is going to be rolled back. Not sure if that can be achieved or a new event would be needed. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.