Hello, i'm trying to generalize the examples in the documentation about multiple table inheritance, namely adding a `Boss` subclassing `Manger`::
class Boss(Manager): pass In the db i'd add a:: boss = Table('boss', metadata, Column('person_id', Integer, ForeignKey('managers.person_id'), primary_key=True), Column('powers', String(50))) i tried updating the `person_join` adding an entry to the map:: ... 'boss':employees.join(managers).join(boss), ... mapper(Boss, boss, inherits=person_mapper, polymorphic_identity='boss') but it fails as soon as a `Boss` instance is created:: ArgumentError: Can't find any foreign key relationships between 'employees' and 'boss' Other tries involved the creation of a most explicit selectable objects for 'boss':: 'boss':employees.join(boss, onclause=employees.c.person_id==boss.c.person_id) .join(managers, onclause=managers.c.person_id==boss.c.person_id), which typically fail the same way. I was able to instantiate an object explicitely adding a fkey (which is redundant for the DB: i'd prefer to avoid it):: boss = Table('boss', metadata, Column('person_id', Integer, ForeignKey('managers.person_id'), ForeignKey('employees.person_id'), primary_key=True), 'boss':employees.join(managers).join(boss, onclause=managers.c.person_id==boss.c.person_id), but the records are not created in the proper order and serialization fails:: >>> ses.save(b) >>> ses.flush() INFO sqlalchemy.engine.base.Engine.0x..34 BEGIN INFO sqlalchemy.engine.base.Engine.0x..34 select nextval('"employees_person_id_seq"') INFO sqlalchemy.engine.base.Engine.0x..34 INSERT INTO employees (person_id, name, type) VALUES ... INFO sqlalchemy.engine.base.Engine.0x..34 INSERT INTO boss (person_id, powers) VALUES ... INFO sqlalchemy.engine.base.Engine.0x..34 ROLLBACK SQLError: (IntegrityError) insert or update on table "boss" violates foreign key constraint "boss_person_id_fkey1" DETAIL: Key (person_id)=(4) is not present in table "managers". Can an inheritance schema like this be implemented with a `polymorphic_union`? Any suggestion? A complete solution would be to fetch a "boss" onto a polymorphic fetch for managers (or for persons of course) Thank you very much, -- Daniele --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---