Hi,

this is a example with « joined table inheritance » feature :

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)

    discriminator = Column('type', String(50))
    __mapper_args__ = {'polymorphic_on': discriminator}

class Contact(Base):
    __tablename__ = 'contacts'

    id = Column(Integer, primary_key=True)

    discriminator = Column('type', String(50))
    __mapper_args__ = {'polymorphic_on': discriminator}


class Employee(Base):
    __tablename__ = 'employees'
    __mapper_args__ = {'polymorphic_identity': 'employee'}

    employee_id = Column('id', Integer, ForeignKey('user.id'),
                                        primary_key=True)


class Customer(Base):
    __tablename__ = 'customers'

    __mapper_args__ = {'polymorphic_identity': 'customer'}

    customer_id = Column('id', Integer, ForeignKey('user.id'),
                                        primary_key=True)


Here Employee and Customer inherit from User class.
Now I would like append another heritage from Contact, then two
heritage (User and Contact).

It's possible to do that with SQLAlchemy ?

Thanks for your help.

Regards,
Stephane

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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