Re: prefetch_related - new feature suggestion

2011-10-03 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Luke, Thanks for the thorough reply! I'm convinced that it wouldn't make sense to merge select_related and prefetch_related; I wish I had a better suggestion for a name for prefetch_related, but I don't. Consider my concern withdrawn. Carl -BE

Re: prefetch_related - new feature suggestion

2011-10-03 Thread Luke Plant
Hi Carl, Thanks for the feedback, sorry for the length of my reply, I tried to be detailed to avoid you having to read the code. On 03/10/11 20:44, Carl Meyer wrote: > My only real concern is one I'm a bit surprised hasn't been raised > already: API and naming sanity. If I'm a new user coming to

Re: prefetch_related - new feature suggestion

2011-10-03 Thread Anssi Kääriäinen
On Oct 3, 10:44 pm, Carl Meyer wrote: > Hi Luke, > > On Oct 3, 9:04 am, Luke Plant wrote: > > > The patch for this is now ready, as far as I'm concerned, but I'd like > > to bring it up here again before committing, mainly because Alex Gaynor > > expressed some doubts. > > > The latest patch is o

Re: prefetch_related - new feature suggestion

2011-10-03 Thread Anssi Kääriäinen
On Oct 3, 6:04 pm, Luke Plant wrote: > Hi all, > > The patch for this is now ready, as far as I'm concerned, but I'd like > to bring it up here again before committing, mainly because Alex Gaynor > expressed some doubts. I have done a review of the patch, and I think it is commit ready. There has

Re: prefetch_related - new feature suggestion

2011-10-03 Thread Carl Meyer
Hi Luke, On Oct 3, 9:04 am, Luke Plant wrote: > The patch for this is now ready, as far as I'm concerned, but I'd like > to bring it up here again before committing, mainly because Alex Gaynor > expressed some doubts. > > The latest patch is on the ticket: > > https://code.djangoproject.com/ticke

Re: prefetch_related - new feature suggestion

2011-10-03 Thread Luke Plant
Hi all, The patch for this is now ready, as far as I'm concerned, but I'd like to bring it up here again before committing, mainly because Alex Gaynor expressed some doubts. The latest patch is on the ticket: https://code.djangoproject.com/ticket/16937 It is much longer than before, but mainly

Re: prefetch_related - new feature suggestion

2011-10-01 Thread drakkan
This look great! I think this approach is better than the one's used by other orms that force a single, heavy, query to retrieve the whole many to many object graphs, would be nice to see it in 1.4 thanks Nicola On 1 Ott, 04:42, Luke Plant wrote: > On 29/09/11 21:43, Alex Gaynor wrote: > > > Whe

Re: prefetch_related - new feature suggestion

2011-09-30 Thread Luke Plant
On 29/09/11 21:43, Alex Gaynor wrote: > When I did this externally a number of years ago, I basically subclassed > ManyToManyField, overrode a bunch of code (quite a bit of copy paste as > I recall), and it's related manager and made it return a custom > queryset, which used a cache off of the obj

Re: prefetch_related - new feature suggestion

2011-09-30 Thread Luke Plant
On 29/09/11 21:40, Florian Apolloner wrote: > > > On Tuesday, September 27, 2011 11:37:06 PM UTC+2, Peter wrote: > > I'd just like to chime in to say this should definitely be part of > core - it's a common requirement, and whilst it could be a third party > app, it certainly feels m

Re: prefetch_related - new feature suggestion

2011-09-29 Thread Alex Gaynor
On Thu, Sep 29, 2011 at 4:40 PM, Florian Apolloner wrote: > > > On Tuesday, September 27, 2011 11:37:06 PM UTC+2, Peter wrote: >> >> I'd just like to chime in to say this should definitely be part of >> core - it's a common requirement, and whilst it could be a third party >> app, it certainly fee

Re: prefetch_related - new feature suggestion

2011-09-29 Thread Florian Apolloner
On Tuesday, September 27, 2011 11:37:06 PM UTC+2, Peter wrote: > > I'd just like to chime in to say this should definitely be part of > core - it's a common requirement, and whilst it could be a third party > app, it certainly feels much more at home in core. > +1, especially if it works with

Re: prefetch_related - new feature suggestion

2011-09-28 Thread Luke Plant
On 28/09/11 00:07, Johannes Dollinger wrote: > > Am 27.09.2011 um 05:18 schrieb Luke Plant: > >> 1) could be done on a per-query basis and >> 2) didn't require changes to the code that would use the QuerySet >> objects i.e. fully API compatible. > > I don't believe (2) is an important requiremen

Re: prefetch_related - new feature suggestion

2011-09-27 Thread Johannes Dollinger
Am 27.09.2011 um 05:18 schrieb Luke Plant: > On 27/09/11 03:23, Alex Gaynor wrote: > >> I'm not a fan of this, for a few reasons, firstly: because it feels >> wrong for a QuerySet to execute multiple queries. This isn't a deal >> breaker, just something that struck my conceptually initially. S

Re: prefetch_related - new feature suggestion

2011-09-27 Thread Peter
I'd just like to chime in to say this should definitely be part of core - it's a common requirement, and whilst it could be a third party app, it certainly feels much more at home in core. On Sep 27, 1:13 pm, Luke Plant wrote: > For me, QuerySet is at a level of abstraction where I don't think it

Re: prefetch_related - new feature suggestion

2011-09-27 Thread Luke Plant
Hi Alex, Just replying to your other objections, now I've had some time to think about them: On 27/09/11 03:23, Alex Gaynor wrote: > I'm not a fan of this, for a few reasons, firstly: because it feels > wrong for a QuerySet to execute multiple queries. This isn't a deal > breaker, just somethin

Re: prefetch_related - new feature suggestion

2011-09-27 Thread koenb
On 27 sep, 05:18, Luke Plant wrote: > On 27/09/11 03:23, Alex Gaynor wrote: > > Would you like to share your solution? I found it pretty difficult to > come up with anything that: > > 1) could be done on a per-query basis and > 2) didn't require changes to the code that would use the QuerySet >

Re: prefetch_related - new feature suggestion

2011-09-26 Thread Luke Plant
On 27/09/11 03:23, Alex Gaynor wrote: > I'm not a fan of this, for a few reasons, firstly: because it feels > wrong for a QuerySet to execute multiple queries. This isn't a deal > breaker, just something that struck my conceptually initially. Second I > disagree that it's difficult to do outside

Re: prefetch_related - new feature suggestion

2011-09-26 Thread Alex Gaynor
On Mon, Sep 26, 2011 at 9:50 PM, Luke Plant wrote: > Hi all, > > I finally got fed up with the common performance problem of ending up > doing O(n) DB queries when you need the (many) related objects of a list > of objects, and did something about it: > > https://code.djangoproject.com/ticket/169

prefetch_related - new feature suggestion

2011-09-26 Thread Luke Plant
Hi all, I finally got fed up with the common performance problem of ending up doing O(n) DB queries when you need the (many) related objects of a list of objects, and did something about it: https://code.djangoproject.com/ticket/16937 I'm pretty sure the concept is something desirable, the probl