Re: [sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-10 Thread Alessandro Molina
On Fri, Mar 10, 2017 at 3:40 PM, mike bayer wrote: > If this is truly, "unexpected error but we need to do things", perhaps you > can use before_flush() to memoize the details you need for a restore inside > of session.info. > > An event hook can be added but it would

[sqlalchemy] Looks like there is no event to catch "before" a rollback happens

2017-03-09 Thread Alessandro Molina
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

[sqlalchemy] Lazy ForeignKey declaration

2014-01-13 Thread Alessandro Molina
Just noticed that SQLAlchemy 0.9 broke a LazyForeignKey class that was provided by TurboGears tgext.pluggable to make possible to declare foreign keys to models not yet defined at the time the ForeignKey was declared. The main use was something like: class User(DeclarativeBase):

Re: [sqlalchemy] Lazy ForeignKey declaration

2014-01-13 Thread Alessandro Molina
Looks good, just one curiosity, is there a reason for using after_parent_attach event instead of directly using _set_parent to register the LazyForeignKey for being resolved? 2014/1/13 Michael Bayer mike...@zzzcomputing.com On Jan 13, 2014, at 1:19 PM, Alessandro Molina alessandro.mol