diff options
| author | Taavi Burns <taavi.burns@gmail.com> | 2012-12-31 00:31:43 -0500 |
|---|---|---|
| committer | Taavi Burns <taavi.burns@gmail.com> | 2012-12-31 00:31:43 -0500 |
| commit | 3657f2122477c7d871467a2a4e9b8897a49c5942 (patch) | |
| tree | e127e36dcc6c883236570b963386943be256d436 | |
| parent | 9a8711c3607f74ce1bea57102f174605202fac35 (diff) | |
| download | sqlalchemy-3657f2122477c7d871467a2a4e9b8897a49c5942.tar.gz | |
Adjusts example code so it can be successfully pasted into a REPL.
| -rw-r--r-- | doc/build/orm/inheritance.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/build/orm/inheritance.rst b/doc/build/orm/inheritance.rst index e3067b071..4a5c30937 100644 --- a/doc/build/orm/inheritance.rst +++ b/doc/build/orm/inheritance.rst @@ -349,12 +349,10 @@ of employees which are associated with a ``Company`` object. We'll add a __tablename__ = 'company' id = Column(Integer, primary_key=True) name = Column(String(50)) - employees = relationship("Employee", backref='company', cascade='all, delete-orphan') - class Employee(Base): __tablename__ = 'employee' id = Column(Integer, primary_key=True) @@ -362,18 +360,20 @@ of employees which are associated with a ``Company`` object. We'll add a company_id = Column(Integer, ForeignKey('company.id')) __mapper_args__ = { 'polymorphic_on':type, - 'polymorphic_identity':employee', + 'polymorphic_identity':'employee', 'with_polymorphic':'*' } class Engineer(Employee): __tablename__ = 'engineer' id = Column(Integer, ForeignKey('employee.id'), primary_key=True) + engineer_info = Column(String(50)) __mapper_args__ = {'polymorphic_identity':'engineer'} class Manager(Employee): __tablename__ = 'manager' id = Column(Integer, ForeignKey('employee.id'), primary_key=True) + manager_data = Column(String(50)) __mapper_args__ = {'polymorphic_identity':'manager'} When querying from ``Company`` onto the ``Employee`` relationship, the |
