[sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-03 Thread David Chanin
How do objects get registered into the aggressive loader? Does it happen automatically when they're initially loaded via query or cache? Ideally we wanted to group items together when they're loaded and do bulk lazy loading on that group rather than on all models in the session, but couldn't

Re: [sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-03 Thread David Chanin
Interesting - so it will be possible in 1.2 to do more custom relationship loading in a "post load" hook? Thanks for the feedback! That definitely makes sense - I didn't fully understand all the logic in _emit_lazyload() initially so I wasn't sure what was OK to remove and what wasn't. I made

[sqlalchemy] Re: Object Relational Tutorial bug

2017-05-03 Thread xela
Thank you. I've encountered the idea before, but didn't make the connection when I read it here. On Tuesday, April 25, 2017 at 10:28:46 PM UTC-4, Jonathan Vanasco wrote: > > This is referencing a concept in software design termed "opinionated". > > Do a search for "opinionated framework" or

[sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-03 Thread Jonathan Vanasco
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: *

Re: [sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-03 Thread mike bayer
Related note, in 1.2 I'm adding a new mechanism for loading things which is a "post load" hook, that is, a bunch of objects are loaded in a query, and then afterwards, more loaders can run on a batch of completed objects. The effect looks similar to how "subqueryload" works right now,

[sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-03 Thread David Chanin
Ack, thanks Simon! That is definitely a bug :). I just pushed a fix. Thanks for the feedback! David On Wednesday, May 3, 2017 at 5:47:54 PM UTC+8, David Chanin wrote: > > Hi Everyone, > > We just open-sourced a custom lazy loader for SQLAlchemy that does bulk > lazy loading of relations -

Re: [sqlalchemy] Bulk Lazy Loader for relationships

2017-05-03 Thread Simon King
On Wed, May 3, 2017 at 10:47 AM, David Chanin wrote: > Hi Everyone, > > We just open-sourced a custom lazy loader for SQLAlchemy that does bulk lazy > loading of relations - essentially a lazy subqueryload. The idea is that > whenever a relation is lazy-loaded on a model, the

[sqlalchemy] Bulk Lazy Loader for relationships

2017-05-03 Thread David Chanin
Hi Everyone, We just open-sourced a custom lazy loader for SQLAlchemy that does bulk lazy loading of relations - essentially a lazy subqueryload. The idea is that whenever a relation is lazy-loaded on a model, the loader will look for all similar models in the session that haven't had that