> so, brand new underlying UnitOfWork, brand new dictionary. Since i > dont understand the case you are describing (how do you "select" > items of class C from class A ? i dont understand what that means), > you might want to attach a reproducible test case.
okay just ran some tests and it happens when i have A<-B<-C<-D inheritance I'm using multiple table polymorphic inheritance (as described in the docs) so i can do A.select() and get a list of A,B,C and D instances, which works fine except when i clear the session, instances of D have their members unitialized here's a sample test: from sqlalchemy import * metadata = BoundMetaData('sqlite:///') class A(object): def __init__(self, a): self.a = a def __repr__(self): return '<A a=%s>' % self.a class B(A): def __init__(self, a, b): self.a = a self.b = b def __repr__(self): return '<B a=%s b=%s>' % (self.a, self.b) class C(B): def __init__(self, a, b, c): self.a = a self.b = b self.c = c def __repr__(self): return '<C a=%s b=%s c=%s>' % (self.a, self.b, self.c) class D(C): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d def __repr__(self): return '<D a=%s b=%s c=%s d=%s>' % (self.a, self.b, self.c, self.d) a_table = Table('a_table', metadata, Column('id', Integer, primary_key=True), Column('a', String(32)), Column('type', String(30))) b_table = Table('b_table', metadata, Column('id', Integer, ForeignKey('a_table.id'), primary_key=True), Column('b', String(32))) c_table = Table('c_table', metadata, Column('id', Integer, ForeignKey('b_table.id'), primary_key=True), Column('c', String(32))) d_table = Table('d_table', metadata, Column('id', Integer, ForeignKey('c_table.id'), primary_key=True), Column('d', String(32))) abcd_union = polymorphic_union( { 'd':a_table.join(b_table).join(c_table).join(d_table), 'c':a_table.join(b_table).join(c_table), 'b':a_table.join(b_table), 'a':a_table.select(a_table.c.type=='a') }, None) bcd_union = polymorphic_union( { 'd':a_table.join(b_table).join(c_table).join(d_table), 'c':a_table.join(b_table).join(c_table), 'b':a_table.join(b_table), }, None) cd_union = polymorphic_union( { 'd':a_table.join(b_table).join(c_table).join(d_table), 'c':a_table.join(b_table).join(c_table), }, None) a_mapper = mapper(A, a_table, select_table=abcd_union, polymorphic_on=abcd_union.c.type, polymorphic_identity='a') b_mapper = mapper(B, b_table, select_table=bcd_union, inherits=a_mapper, polymorphic_on=bcd_union.c.type, polymorphic_identity='b') c_mapper = mapper(C, c_table, select_table=cd_union, inherits=b_mapper, polymorphic_on=cd_union.c.type, polymorphic_identity='c') mapper(D, d_table, inherits=c_mapper, polymorphic_identity='d') a_table.create() b_table.create() c_table.create() d_table.create() session = create_session() session.save(A(a='aaa')) session.save(B(a='aaa',b='bbb')) session.save(C(a='aaa',b='bbb',c='ccc')) session.save(D(a='aaa',b='bbb',c='ccc',d='ddd')) session.flush() #comment this clear for success session.clear() l = session.query(A).select() print l l = session.query(D).select() assert l[0].d == 'ddd' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---