thats a bug (which I alluded to in my previous email)

On Mar 24, 2007, at 4:18 PM, Rick Morrison wrote:

> thanks, but either I'm confused, or I wasn't clear.
>
> There is no tableB1. The object B1 inherits from B, still using  
> tableB via single-table inheritance. Doing this via lazy load works  
> OK; the where filter is issued. It's not issued if I try to load  
> via eagerload either using .options() or lazy=False in the  
> relationship.
>
> In other words, I get one result if I load lazy, and a different  
> result if I eagerload, which I'm interpreting as "not good".   
> You're telling me that this is the way it's supposed to work?
>
> Rick
>
>
> On 3/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] >  
> wrote:
>
> in your case, u'll get (tB1 join tB) and that would give u only the B1
> instances, so no need for where-filter. If there is a B2 inheriting
> B1, then u'll need the additional filtering on type, e.g.
> - base level needs filtering .select(type==B)
> - leaf levels needs join B2.join(B1).join(B)
> - intermediate levels need both -  B1.join(B).select(type=B1)
>
> in general it's not that easy; this looks so only if all
> class-inheritance is decomposed as multi-table-inheritance. To get
> true polymorphic relations this is the only 100% working way, but if
> one doesnt need them, one could use concrete tables here or there,
> which makes the above scheme somewhat more complicated.
>
>
> On Saturday 24 March 2007 03:15:51 Rick Morrison wrote:
> > Given this:
> >
> > class A(object):
> >     pass
> >
> > class B(object):
> >     pass
> >
> > class B1(B):
> >     pass
> >
> > mb = mapper(B, tableB, polymorphic_on= tableB.c.typ)
> >
> > mb1 = mapper(B1, inherits=mb, polymorphic_identity="abc")
> >
> > ma = mapper(A, tableA,
> >           properties = {'mybee': relation(B1, lazy=False) }
> >          )
> >
> >
> > Shouldn't a query like
> >
> >   S.query(A).list()
> >
> > issue SQL that restricts the resulting join to where tableB.c.typ =
> > "abc" ?
> >
> > or is it necessary to re-specify that
> > polymorphic type condition in the relation for 'mybee'?
> >
> > Thanks,
> > Rick
> >
> >
>
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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