On Monday, May 7, 2018 at 10:27:03 PM UTC-4, Mike Bayer wrote:
>
> can you perhaps place a "pdb.set_trace()" inside of session._flush()? 
> using the debugger you can see the source of every flush() call. 
> Generally, it occurs each time a query is about to emit SQL. 
>
>
Building off what Mike said... it's going to emit sql + flush if you are 
accessing any attributes or relationships that haven't been loaded 
already.  So if the object only had a few columns loaded (via load_only or 
deferred) or didn't load all the relationships, your code is iterating over 
the columns and relationships so will trigger a load.

It may make sense to turn autoflush off and manually call flush as needed.

-- 
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.

Reply via email to