I am running an app that using sqlalchemy to access db layer. now I need to get all the insert, update, delete operation, I wrote db operation in two many places and seems it will be very risky to change those code. Is there anyway that I could just change sqlalchemy’s code and capture all “insert, update, delete” operations?
I tried to find execute, but there was too many definitions:
lib/python2.6/site-packages/SQLAlchemy-0.5.3-py2.6.egg/sqlalchemy/engine/base.py
463: def execute(self, *multiparams, **params):
500: def execute(self, object, *multiparams, **params):
819: def execute(self, object, *multiparams, **params):
1200: def execute(self, statement, *multiparams, **params):
1280: def execute(self, object, *multiparams, **params):
1808: def execute(self):
1855: def execute_string(self, stmt, params=None):
See
before_executeand other events documented in Connection Events. Sample from documentation verbatim: