Thanks for all this help, Mike! On Tuesday, May 1, 2018 at 8:56:35 PM UTC-4, Mike Bayer wrote: > > at what "moment in time"? I thought you might mean when they are > expired from the Session, easy enough use the expire event > > http://docs.sqlalchemy.org/en/latest/orm/events.html?highlight=expire%20event#sqlalchemy.orm.events.InstanceEvents.expire > > but then you are saying "detached by their nature", as though they are > created that way. >
This event looks like what I need. I'll add it into my debugger's code tomorrow! one of the `persistent_to_` events might be better... more below. > inspect(instance).expired_attributes > The inspector would have been a better idea. I got lazy and was just going through the object in pdb! > but when you say "dead weakref" I think we are again getting at this > "moment in time" you refer towards > ... > preserve it from....when ? when is it there? why did it go away ? > The debugging tool essentially decorates a web request with a middleware-like context-wrapper like flow, then allows it to be inspected in another browser window. The particular functionality I'm working with stashes some ORM objects onto the request record, and a custom debugging panel is used to audit/inspect the objects that were stashed on the request (the last 20 requests are stored in-memory and available to the debugging tool). 'By their inherent nature' meant everything in the debugger tool occurred in a session that had previously ended with an explicit `close()`. The flow looks like this: * request made * debugger wrapper starts ** sqlalchemy session starts *** activity ** sqlalchemy session close() * debugger wrapper cleanup * debugger wrapper ends So I'm basically trying to access the object's state in `*** activity` prior to `** close` The events look right. If I can't hack something with them, I'll just stash a dict of the object if there is a flag for the dev environment present. -- 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 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.