[sqlalchemy] Query help

2010-10-16 Thread rake
Table structure: A(id, name) B(id, name, A_id) C(id, name, B_id) one-to-many A-B and B-C I'm trying to use session.query() to select all rows of A such that none of the joined B rows have any joined C rows. A: (1,'A1') (2,'A2') B: (1,'B1',1) (2,'B2',1) (3,'B3',2) C: (1,'C1',1) So, it would

[sqlalchemy] Loading classes polymorphically

2009-08-13 Thread rake
Assuming I have the following simplified classes: class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) type = Column(Unicode) enabled = Column(Boolean) __mapper_args__ = {'polymorphic_on': type} class B(A): __tablename__ = 'b' __mapper_args__ =

[sqlalchemy] Re: Loading classes polymorphically

2009-08-13 Thread rake
Thanks your quick respone, that is exactly what I was looking for. On Aug 13, 10:40 am, Michael Bayer mike...@zzzcomputing.com wrote: you're looking for query.with_polymorphic().  see the mapping documentation section on joined table inheritance for details. rake wrote: Assuming I have