summaryrefslogtreecommitdiff
path: root/test/ext/declarative
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-15 18:42:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-15 18:42:59 -0400
commit54808ecccd9f6e7907f4762f6df33e1ad303189c (patch)
treedc70f48d77371ea44c6422e243b96ce4fd1c329f /test/ext/declarative
parent6d8643a1560015de0fefefc7a0ca87b1cc9ce3fd (diff)
downloadsqlalchemy-54808ecccd9f6e7907f4762f6df33e1ad303189c.tar.gz
- [bug] Declarative can now propagate a column
declared on a single-table inheritance subclass up to the parent class' table, when the parent class is itself mapped to a join() or select() statement, directly or via joined inheritane, and not just a Table. [ticket:2549]
Diffstat (limited to 'test/ext/declarative')
-rw-r--r--test/ext/declarative/test_inheritance.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ext/declarative/test_inheritance.py b/test/ext/declarative/test_inheritance.py
index 5a8c8e23e..c7117fb43 100644
--- a/test/ext/declarative/test_inheritance.py
+++ b/test/ext/declarative/test_inheritance.py
@@ -577,6 +577,30 @@ class DeclarativeInheritanceTest(DeclarativeTestBase):
eq_(sess.query(Engineer).filter_by(primary_language='cobol'
).one(), Engineer(name='vlad', primary_language='cobol'))
+ def test_single_from_joined_colsonsub(self):
+ class Person(Base, fixtures.ComparableEntity):
+
+ __tablename__ = 'people'
+ id = Column(Integer, primary_key=True,
+ test_needs_autoincrement=True)
+ name = Column(String(50))
+ discriminator = Column('type', String(50))
+ __mapper_args__ = {'polymorphic_on': discriminator}
+
+ class Manager(Person):
+ __tablename__ = 'manager'
+ __mapper_args__ = {'polymorphic_identity': 'manager'}
+ id = Column(Integer, ForeignKey('people.id'), primary_key=True)
+ golf_swing = Column(String(50))
+
+ class Boss(Manager):
+ boss_name = Column(String(50))
+
+ is_(
+ Boss.__mapper__.column_attrs['boss_name'].columns[0],
+ Manager.__table__.c.boss_name
+ )
+
def test_polymorphic_on_converted_from_inst(self):
class A(Base):
__tablename__ = 'A'