Re: Efficient method to execute a query

2007-04-15 Thread Tejas Shah
Hi Michael Thanks for the response I don't think select_related works backwards on relations, so I wouldn't be able to use it for the rating_set part I think I've possibly come across a nice solution, by generating Left Join Queries through django's own sql query mechanism http://groups.google.

Re: Efficient method to execute a query

2007-04-15 Thread Michael Trier
Tejas, Can you not use the select_related on the queryset to eager load the relationships? Michael On 4/15/07, Michael Trier <[EMAIL PROTECTED]> wrote: > On 4/15/07, Tejas Shah <[EMAIL PROTECTED]> wrote: > > Thanks guys > > > > The problem in this case with querying against ItemRatingsByGroup i

Re: Efficient method to execute a query

2007-04-15 Thread Michael Trier
On 4/15/07, Tejas Shah <[EMAIL PROTECTED]> wrote: > Thanks guys > > The problem in this case with querying against ItemRatingsByGroup is that > not all Items are in there. > > Only the items that have been rated are in items rated by group > > I'm looking to display as following: > > The Group >

Re: Efficient method to execute a query

2007-04-15 Thread Tejas Shah
Thanks guys The problem in this case with querying against ItemRatingsByGroup is that not all Items are in there. Only the items that have been rated are in items rated by group I'm looking to display as following: The Group All the items in the group A rating for each item - if a rating

Re: Efficient method to execute a query

2007-04-15 Thread Michael Trier
You need to query against your ItemRatingsByGroup table directly where the group_id equals the group you want. That will give you all the info you want, the item, the group, and the rating. Michael On 4/15/07, Paul Rauch <[EMAIL PROTECTED]> wrote: > > tejas schrieb: > > Hi - I'm a Django newbie

Re: Efficient method to execute a query

2007-04-15 Thread Paul Rauch
tejas schrieb: > Hi - I'm a Django newbie and I have a query that, using the syntax in > the database API, would become very slow. I'm wondering what the way > around it is. > > I have 3 tables > > Group -- contains a list of groups > > > Item: (each item belongs to a group) > ForeignKey(

Efficient method to execute a query

2007-04-15 Thread tejas
Hi - I'm a Django newbie and I have a query that, using the syntax in the database API, would become very slow. I'm wondering what the way around it is. I have 3 tables Group -- contains a list of groups Item: (each item belongs to a group) ForeignKey(groupid) ItemRatingsByGroup: (the ra