We have a somewhat tangential solution that was developed when building a read-through cache that backs into SqlAlchemy.
Instead of working on the Session, we register items for 'aggressive loading' into a custom class instance that handles the coordination. Our system works like this: * objects are registered with the aggressive loader * the aggressive loader is triggered: ** the registered objects are recursively analyzed to find primary key relationships that should be loaded ** for each object type, the unloaded primary keys are loaded ** some relationships are specified to run on a second pass Aside from the eagerloading advantages, this improved performance for a few more reasons: * only the necessary data was requested/loaded. this eased the database and wire traffic (i.e. at the db level a joined object is calculated once, not once per relationship) * the queries were easier on the DB, as simple "get by primary key" requests - not wrapped joins. -- 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.