Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-25 Thread Alex Gaynor
On Tue, Aug 25, 2009 at 10:41 AM, Carl Meyer wrote: > > > > On Aug 23, 9:14 pm, Andrea Zilio wrote: >> So the answer to the question "Can I get the right instances with one >> single and only DB query" seems to be: >> "No, you cannot do so without

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-25 Thread Carl Meyer
On Aug 23, 9:14 pm, Andrea Zilio wrote: > So the answer to the question "Can I get the right instances with one > single and only DB query" seems to be: > "No, you cannot do so without touching the Django orm code". > > Am I right? Actually, I think the ORM's extensibility

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Andrea Zilio
So the answer to the question "Can I get the right instances with one single and only DB query" seems to be: "No, you cannot do so without touching the Django orm code". Am I right? On Aug 24, 1:52 am, Russell Keith-Magee wrote: > > > Or if this is planned for some

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Russell Keith-Magee
On Sun, Aug 23, 2009 at 11:00 PM, Andrea Zilio wrote: > > Great, but that wasn't exactly what I was looking for. > > What I need is a way to get the right instances from a *single* query. > > This means that I should do LEFT JOINS on direct subclasses of the > base class. > >

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Andrea Zilio
Great, but that wasn't exactly what I was looking for. What I need is a way to get the right instances from a *single* query. This means that I should do LEFT JOINS on direct subclasses of the base class. What I need to know is if this is somehow possible without editing the Django core, but

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Marc Fargas
On Sun, Aug 23, 2009 at 1:54 PM, Andrea Zilio wrote: > > So seems that this idea was in fact rejected because of the O(# of > nodes in the inheritance tree) joins > needed to get all the fields from subclass tables. > You may want to loook at Alex's post on the subject:

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Andrea Zilio
Thanks! I think I've found the discussion you're talking about: http://groups.google.com/group/django-developers/browse_thread/thread/7d40ad373ebfa912/a20fabc661b7035d So seems that this idea was in fact rejected because of the O(# of nodes in the inheritance tree) joins needed to get all the

Re: On returning appropriate subclass instances when querying a model with subclasses

2009-08-23 Thread Russell Keith-Magee
On Sun, Aug 23, 2009 at 9:18 AM, Andrea Zilio wrote: > > Hi all, > > Here's what I'm talking about: > You have 3 models: Place, Restaurant and Cinema where Restaurant and > Cinema both inherits from Place. > So in the database you have some simple places, some places which >

On returning appropriate subclass instances when querying a model with subclasses

2009-08-22 Thread Andrea Zilio
Hi all, Here's what I'm talking about: You have 3 models: Place, Restaurant and Cinema where Restaurant and Cinema both inherits from Place. So in the database you have some simple places, some places which really are Cinemas and some places which really are Restaurants. Well, I think that this