zopefoundation / zope.sqlalchemy

Integration of SQLAlchemy with transaction management
Other
32 stars 34 forks source link

deregister zope.sqlalchemy.register() #9

Open philtay opened 10 years ago

philtay commented 10 years ago

There should be a deregister() counterpart to the new zope.sqlalchemy.register() function. It will be useful in contexts where you have to use the same Session but with different transactional behaviours. For instance, depending on the situation, you may need to (dynamically) set keep_session=False or keep_session=True. This is very easy to accomplish using the old SQLAlchemy extension system. You just use Session.configure. On the other hand, using the new register() function, there is no way to do it. I think that sqlalchemy.event.remove should do the trick.

http://docs.sqlalchemy.org/en/rel_0_9/core/event.html#sqlalchemy.event.remove