>
> I want to direct your attention to some new features in trunk which
> I'll also be demonstrating at this years Advanced SQLAlchemy
> tutorial.
>
> these features apply primarily to joined-table inheritance
> scenarios, and are in response to the need to specify criterion
> against subclasses as well as to join to/from joined-table classes
> where a specific subclass is required.
>
> I've put some new docs at
> http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mappe
>r_inheritance_joined_querying .
>
> the two methods are with_polymorphic() and of_type().
>
> with_polymorphic() may very well replace the need for select_table
> in almost all cases, and it creates the joins for you.  It allows
> filtering criterion to be against subclasses, *and* allows the
> mapper to load the full subclass instance without the need for a
> second query against the joined table.
>
> Assume the usual Person / Engineer(Person) / Manager(Person)
> example :
>       # query for Person objects, but specify criterion against Engineer
>
> session
> .query
> (Person
> ).with_polymorphic(Engineer).filter(Engineer.engineer_name=='dilber
>t')
>
>       # query for Person objects but specify criterion against both
> Manager and Engineer
>       session.query(Person).with_polymorphic([Engineer,
> Manager]).filter(or_(Engineer.engineer_name=='dilbert',
> Manager.manager_name=='dogbert'))
>
>       # eagerly load all joined-table subclasses
>       session.query(Person).with_polymorphic('*').filter(...filter on
> any table..).all()

let me see if i got it... does this mean that, in the a-b-c-.. mapper 
hierarchy i do not have anymore to use the selecttable= 
a.outerjoin(b) (and eventualy .outerjoin(c) etc) on each level, but 
instead use only one mapper (a) for everything, just having different 
query.with_poly(x) for each subclass x?

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