Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-16 Thread Martijn van Oosterhout
On Thu, 15 Nov 2018 at 16:41, Mike Bayer wrote: > > > > But then you lose the benefits of the cache, and the Bakery is only > useful if you use the same Querys over and over. Unless I've completely > misunderstood how it works. > > well the "anonymous" bindparam() still has a name. you just

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-15 Thread Mike Bayer
On Thu, Nov 15, 2018 at 10:17 AM Martijn van Oosterhout wrote: > > > > On Thu, 15 Nov 2018 at 14:55, Mike Bayer wrote: >> >> > And have all the query compilation cached. All the query stuff can be put >> > near the model so your code isn't covered with fragments of SQLAlchemy. I >> > have no

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-15 Thread Martijn van Oosterhout
On Thu, 15 Nov 2018 at 14:55, Mike Bayer wrote: > > And have all the query compilation cached. All the query stuff can be > put near the model so your code isn't covered with fragments of SQLAlchemy. > I have no idea if this pattern is common, but it works well for us. > > filter_by_id and

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-15 Thread Mike Bayer
On Thu, Nov 15, 2018 at 12:27 AM Martijn van Oosterhout wrote: > > Hoi Mike, > > On Wednesday, November 14, 2018 at 11:30:18 PM UTC+1, Mike Bayer wrote: >> >> I have some big ideas for the baked concept which may or may not >> impact this area as well. But they are only ideas for now, I have >>

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Martijn van Oosterhout
Hoi Mike, On Wednesday, November 14, 2018 at 11:30:18 PM UTC+1, Mike Bayer wrote: > > I have some big ideas for the baked concept which may or may not > impact this area as well. But they are only ideas for now, I have > many explicit SQLAlchemy tasks that I have to get done before I can >

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Mike Bayer
I have some big ideas for the baked concept which may or may not impact this area as well. But they are only ideas for now, I have many explicit SQLAlchemy tasks that I have to get done before I can try to explore that stuff. On Wed, Nov 14, 2018 at 4:34 PM Martijn van Oosterhout wrote: > >

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Martijn van Oosterhout
Hoi Mike, You're right, we should probably measure it first. You state that the simple joins and filters are probably cheap which I don't doubt. We also do correlated subqueries and stuff. Actually, we also use the baking mechanism to cache some of our own processing which goes into the

Re: [sqlalchemy] Caching intermediate results in baked queries

2018-11-14 Thread Mike Bayer
On Tue, Nov 13, 2018 at 3:49 PM Martijn van Oosterhout wrote: > > Hoi, > > We're starting to do some pretty complicated things with the SQLAlchemy > bakery (because we have some pretty complicated queries) and I have something > I'd like to verify. > > We have queries that are constructed like