Given the following relationships:

employees_table = Table('employees', metadata,
    Column('id', Integer, primary_key=True),
    Column('row_type', Integer, nullable=False)
    Column('name', String(50)),
    Column('is_certified', Boolean)
)

employee_mapper = mapper(Employee, employees_table,
    polymorphic_on=employees_table.c.row_type,
polymorphic_identity=1,
    exclude_properties=['is_certified'])
manager_mapper = mapper(Manager, inherits=employee_mapper,
polymorphic_identity=2,
    properties={
        'is_certified': employees_table.c.is_certified
    })

How can I query for employees who aren't managers or managers who are
certified without referring to the polymorphic identity? Basically,
without doing this:

session.query(Employee).filter(or_(Employee.row_type!=2,
Manager.is_certified==True))

Thanks!

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

Reply via email to