[Sqlalchemy-tickets] Issue #4181: @event.listens_for(Engine, 'before_cursor_execute') seems to be f
Brought to you by:
zzzeek
New issue 4181: @event.listens_for(Engine, 'before_cursor_execute') seems to be firing twice for an engine created `with_execution_options` from one that was created without! https://bitbucket.org/zzzeek/sqlalchemy/issues/4181/eventlistens_for-engine Antti Haapala: This seems to be reproducible with SQLAlchemy 1.1, 1.2, 1.2.2 in *our* code, I've yet to produce a MCVE though, but we have an engine, out of which 2 other engines are created. The intention is that one of the engines is used to explicitly create sessions that have transaction isolation level at SERIALIZABLE, the other at READ COMMITTED - this seemed tricky to get right otherwise However, now we noticed some friction with Pyramid debug toolbar integration, which uses @event.listens_for(Engine, "before_cursor_execute") and @event.listens_for(Engine, "after_cursor_execute") These get called twice with the exact same arguments (str(args) is equal) when using an Engine that has been derived with `execution_options`, and just once when using an Engine that is created with plain constructor... so it would also mean that sharding example code would emit `use` twice per each cursor creation in the example code in http://docs.sqlalchemy.org/en/latest/core/connections.html#sqlalchemy.engine.Engine.execution_options |