On Wednesday, October 12, 2016 at 5:58:41 PM UTC-4, Alfred Perlstein wrote: > > Oh nice!! Will this be called in the context of the same thread > executing the sql? This would allow me to debug without formatting all > debugs I believe... >
It depends on how you're using threads and connections. It should/does under most situations. It is entirely possible that you are using things wrong or are abusing the library -- lots of people do that inadvertently (myself included). Check out the docs on http://docs.sqlalchemy.org/en/latest/orm/contextual.html , and there is also some stuff on threadlocal under pooling. For stuff like this, I just use the approach that Mike advocated -- just filter the standard python logger. An `.ini` file configures my loggers to print the thread id on the line prefix, and I direct sqlalchemy logging to a dedicated file. Then i just grep that file for a given thread id. None of the performance issues you raise make much sense to me -- the overhead is negligible and this would all be done on a dev environment. turning something like this on/off on production would worry me about the application design. Any chance that you coming from another programming language? It sounds like you're unfamiliar with some intricacies on how Python (not just SqlAlchemy) approach certain things, and are overthinking things. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.