Fix events

When I use flask-sqlalchemy session and just sqlalchemy session in one project I have errors (AttributeError) with this events.