Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2013-07-02 Thread Rimvydas Naktinis
Yup, qs.prefetch_related('best_pizza__toppings__topping_type', use_select_related=True) looks good enough for many cases. We have a lot of cases in the code where this would save many queries. On Tuesday, November 27, 2012 2:57:16 PM UTC, Anssi Kääriäinen wrote: > > On 26 marras, 21:36, tolomea

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2013-02-06 Thread Marc Tamlyn
A better way of achieving this functionality would be the API proposed in https://code.djangoproject.com/ticket/17001 Marc On Wednesday, 6 February 2013 00:29:15 UTC, Michal Novotný wrote: > > Hey, what about this > one: qs.prefetch_related('best_pizza__toppings__topping_type_*') > > It is intu

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2013-02-05 Thread Michal Novotný
Hey, what about this one: qs.prefetch_related('best_pizza__toppings__topping_type_*') It is intuitive and simple. But of course, that would mean to add wildcard support everywhere. On Sunday, February 19, 2012 11:18:20 PM UTC+1, Yo-Yo Ma wrote: > > Speaking with regards to the ORM method docume

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-11-27 Thread Anssi Kääriäinen
On 26 marras, 21:36, tolomea wrote: > The focus then is on how to let the developer specify what they want in the > same query and what they want in a different query. > Select_related currently adds same query stuff and prefetch_related > adds separate query stuff. So what if we added a way for a

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-11-27 Thread tolomea
> email]<http://user/SendEmail.jtp?type=node&node=4997386&i=1>. > > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > > > -------------- > If you reply to this email, your message will be added to th

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-11-26 Thread Luke Plant
On 20/11/12 12:08, tolomea wrote: >> it should do exactly what the developer asks. > > How do I, the developer, request that it use select_related for topping_type > part of the best_pizza__toppings__topping_type example given above? Sorry for the slow reply. At the moment, there is no way to sp

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-11-20 Thread tolomea
> it should do exactly what the developer asks. How do I, the developer, request that it use select_related for topping_type part of the best_pizza__toppings__topping_type example given above? -- View this message in context: http://python.6.n6.nabble.com/Could-prefetch-related-be-modified-to

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-02-23 Thread Luke Plant
On 19/02/12 22:18, Yo-Yo Ma wrote: > It doesn't seem to take advantage ``select_related`` (assuming that > ``topping_type`` is a ``ForeignKey`` from ``Topping``. It instead > sends a separate query for ``Topping`` and ``ToppingType``, joining > them in Python. Is it feasible to modify ``prefetch_r

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 12:18 am, Yo-Yo Ma wrote: > Speaking with regards to the ORM method documented > athttps://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-... > > Of course, ``prefetch_related`` uses a Pythonic join to attach reverse- > related objects and avoids the N+1 queries problem,

Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-02-19 Thread Yo-Yo Ma
Speaking with regards to the ORM method documented at https://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-related Of course, ``prefetch_related`` uses a Pythonic join to attach reverse- related objects and avoids the N+1 queries problem, which of course is great. However, if you u