hey there -

in addition to the querying strategies I emailed to you privately, the  
latest trunk also has a new operator "of_type" which allows this  
pattern (as a review, Person joins to Role via the "roles" relation,  
Employee is a subclass of Role):

session 
.query 
(Person 
).filter 
(Person 
.roles.of_type(Employee).any(and_(Role.type=='ResearchAssociate',  
Employee.visible==True))).all()

of_type(class_or_mapper) will cause the any() and has() operators to  
join to the subclass' mapped table instead of the base class of the  
relation().

It also works with join():

session 
.query 
(Person 
).join 
(Person 
.roles.of_type(Employee)).filter(and_(Role.type=='ResearchAssociate',  
Employee.visible==True)).all()



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