well, i tried it manualy and it works (sqlite).

here the eagerloading query:

model-description (joined_inheritance):
class A:
  name = Text()
class B(A):
  address = reference( Adress)
  nom     = reference( Nomerator)
class C(A): pass


select * from A 
 left outer join B on A.db_id = B.db_id 
 left outer join C on A.db_id = C.db_id
 left outer join 
   Address as a1 on p.address_id = address.db_id
 left outer join 
   Nomerator as a2 on p.nom_id = a2.db_id 
;

or with subselects: 

select * from A 
 left outer join B on A.db_id = B.db_id 
 left outer join C on A.db_id = C.db_id
 left outer join 
   ( select * from Address ) as a1 on p.address_id = address.db_id
 left outer join 
   ( select * from Nomerator) as a2 on p.nom_id = a2.db_id 
;



also, i dont see a reason for it not to work if the (A jon B join C) 
is a polymunion - all the same, all columns will be present there, 
having None where missing.

0.4.3?

On Monday 14 January 2008 18:56:16 svilen wrote:
> On Monday 14 January 2008 18:35:40 Michael Bayer wrote:
> > On Jan 14, 2008, at 11:29 AM, svilen wrote:
> > > On Monday 14 January 2008 17:19:14 Michael Bayer wrote:
> > >> On Jan 14, 2008, at 8:41 AM, svilen wrote:
> > >>> i have, say, base class A, inherited by two children B and C.
> > >>> B has an attribute/relation 'address', A and C do not have
> > >>> it. So i had a query(A).eagerload( 'address') and that did
> > >>> work before r3912. But later it gives an error - "mapper|A
> > >>> has no property 'address'".
> > >>> Any hint how to do it now?
> > >>
> > >> what kind of inheritance/mapping  from A->B ?  i cant really
> > >> imagine any way that kind of eager load could have worked
> > >> since the "address" property of "B" does not (and has never)
> > >> get consulted in that case.
> > >
> > > plain joined?... hmm.
> > > maybe it did not really work (eagerly) but lazy-load has fired
> > > instead... seems that's the case.
> > > anyway.
> > > some way to accomplish such thing?
> >
> > no !  this the same issue with the Channel->CatalogChannel thing,
>
> yes i guessed it..
>
> > your query is against "A"...attributes that are only on "B" don't
> > enter into the equation here.
>
> this is somewhat different, my query/filter is on attributes that
> do exist in A; i only want the ORM to postprocess certain things...
> there will be 'address' column in the result-set anyway (empty or
> not), why it cannot be eagerloaded via B.address?
>
> > But also, if youre using
> > select_table, we dont yet support eager loads from a
> > polymorphic-unioned mapper in any case (though we are close).
>
> it is not polymunion, joined_inh works via left-outer-join.
>
> well, no is no.
>
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to