I was having a heck of confusing time debugging some code where I was 
trying to determine what attrs on an ORM changed prior to committing it.  
Every time in my debugger I'd be getting different results (w/r to 
History).  I finally realized that autoflush was enabled, and now that I 
disabled it, things seem much more sane.  The strange part though, is that 
the update/flush would occur randomly while I was just iterating through 
some mapper attributes checking History.  No queries, no nothing... but at 
one point... whoosh... it must have flushed.  

I'm basing the 'has flushed' inference on the fact that my test update is 
updating a foreign key relationship.  I update the relationship object (not 
the ID) on the primary object.  At that point, the FK id is still the old 
id from prior to the change.  Only when I Flush, does the id get updated 
automatically.  Well I watch that ID in a debug watch, and boom... it just 
randomly updates at some point when I'm walking through unrelated fields 
checking for history (not issuing any querys or session activity, as far as 
I can tell).

Just looking for a sanity check if this behavior seems to make sense?  I 
would have thought the auto flushing would happen inline with a query... 
like you step over that query or operation, and the autoflush occurs 
synchronously.  This is not what I'm seeing. 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to