On Nov 5, 12:01 pm, Stéphane Klein <steph...@harobed.org> wrote:
> 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).

I think this is the same question that
http://groups.google.com/group/sqlalchemy/browse_thread/thread/598acb2f6c7e005e/adea68201898e8dc

-- 
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