]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Adjusts example code so it can be successfully pasted into a REPL.
authorTaavi Burns <taavi.burns@gmail.com>
Mon, 31 Dec 2012 05:31:43 +0000 (00:31 -0500)
committerTaavi Burns <taavi.burns@gmail.com>
Mon, 31 Dec 2012 05:31:43 +0000 (00:31 -0500)
doc/build/orm/inheritance.rst

index e3067b07177e70bd40a6bd61de61e9726543544c..4a5c30937b363c15b883c2a4bf15648a2937ac87 100644 (file)
@@ -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