On Thursday, April 23, 2020 at 10:17:12 AM UTC-4, Mike Bayer wrote:
>
> Using the event hook is likely the most direct way to see where it's 
> happening, either via logging or pdb:
>
>
> https://docs.sqlalchemy.org/en/13/orm/events.html?highlight=persistent_to_detached#sqlalchemy.orm.events.SessionEvents.persistent_to_detached
>  
> <https://www.google.com/url?q=https%3A%2F%2Fdocs.sqlalchemy.org%2Fen%2F13%2Form%2Fevents.html%3Fhighlight%3Dpersistent_to_detached%23sqlalchemy.orm.events.SessionEvents.persistent_to_detached&sa=D&sntz=1&usg=AFQjCNFAaNFY8v88K7IcP3wA4GREWPTybA>
>

 
Awesome! Thanks mike. That's exactly what I needed.

After several hours of debugging, I finally tracked down the issue - which 
solved at least 4 outstanding bugs, and let me clear out a bunch of code.  
And now I can have `expire_on_commit` back too!

I never realized that `zope.sqlalchemy.mark_changed(` has it's own 
`keep_session` kwarg... which defaults to `False` and does not inherit from 
the existing configuration. 

I can't tell why the errors on this was inconsistent.  The app has a 
simplified "commit" hook that lets me handle multiple `pyramid_tm` commits 
in a single request, and I invoke mark_changed() in there to pick up a few 
edge cases.  In a small number of these instances, I lost the 
`keep_session` setting - in others I didn't.  








-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/52dbb2c4-8eb7-4de6-b09b-fb5e7f4320ef%40googlegroups.com.

Reply via email to