On Jan 17, 2010, at 12:54 PM, Chris Withers wrote: > Michael Bayer wrote: >>> Michael Bayer wrote: >>>> it is quite simple to implement yourself, use a ConnectionProxy. >>> Ah, ok, didn't know about them :-) >>> Out of interest, is echo=True implemented as a ConnectionProxy? >> its not. CP is a little heavyhanded for just the built-in SQL logging. > > How/where is it implemented? > All I'm ultimately looking for is to insert the following wherever that the > SQL logging is currently done: > > s = StringIO() > traceback.print_stack(file=s) > logging.info('Called from:'+s.getvalue())
the ConnectionProxy execute_cursor() method is invoked at the same time the logging is done. There are similar log hooks around commit and rollback and such. A quick skim around sqlalchemy/engine/base.py should be pretty easy to follow. > >> I've added hooks to intercept all transactional events at a high level in >> r6641. > > Cool, will that land in SA 0.6? that's part of 0.6 yes. > >> There are many, and some such as BEGIN PREPARED result in further statement >> executions as well. > > Not sure what the latter half of this means... DBAPI has no inherent support for two phase transactions, so a COMMIT for example is emitted as SQL along the lines "COMMIT PREPARED 'xid'". The proxy will receive a commit_prepared() event as well as the subsequent execute() events.
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.