Skip to content
Discussion options

You must be logged in to vote

I was digging a bit deeper and found this calls both the listeners:

listen(Session, 'before_flush', session_1)
factory = sessionmaker(bind=engine, autocommit=False)
listen(Session, 'before_flush', session_2)   # NOTE that this is on Session and not on factor

The issue seems to be very specific only when I have a listener on both: Session and factory
The listener on Session is ignored

I tried (naively) to change it to listen(Session, 'before_flush', session_1, propagate=True) but that didn't work either
(I has used propagate when listening to a Model 'before_insert' for something else)

I also tried changing how I create the session:

  • session = Session(bind=engine) - Calls session_1 only
  • se…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zzzeek
Comment options

@zzzeek
Comment options

Answer selected by AbdealiLoKo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants