From: Taavi Burns Date: Mon, 31 Dec 2012 05:31:43 +0000 (-0500) Subject: Adjusts example code so it can be successfully pasted into a REPL. X-Git-Tag: rel_0_8_0~36^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3657f2122477c7d871467a2a4e9b8897a49c5942;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Adjusts example code so it can be successfully pasted into a REPL. --- diff --git a/doc/build/orm/inheritance.rst b/doc/build/orm/inheritance.rst index e3067b0717..4a5c30937b 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