diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-12 15:43:17 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-11-12 15:43:17 +0000 |
| commit | 0148adec3069c64f3dca8d269e4c0fac3fe6bcaf (patch) | |
| tree | 3c51cb7bc367da1299ac800f027ccc242e949ad7 /test | |
| parent | 260c201f656ce3afe35f9ae069cdf46593d4dffb (diff) | |
| download | sqlalchemy-0148adec3069c64f3dca8d269e4c0fac3fe6bcaf.tar.gz | |
- Can now use a custom "inherit_condition" in
__mapper_args__ when using declarative.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ext/declarative.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ext/declarative.py b/test/ext/declarative.py index 1c088d143..13de2f246 100644 --- a/test/ext/declarative.py +++ b/test/ext/declarative.py @@ -536,6 +536,20 @@ class DeclarativeTest(testing.TestBase, testing.AssertsExecutionResults): sess.flush() eq_(sess.query(User).filter(User.name == "SOMENAME someuser").one(), u1) + def test_custom_inh(self): + class Foo(Base): + __tablename__ = 'foo' + id = Column('id', Integer, primary_key=True) + + class Bar(Foo): + __tablename__ = 'bar' + id = Column('id', Integer, primary_key=True) + foo_id = Column('foo_id', Integer) + __mapper_args__ = {'inherit_condition':foo_id==Foo.id} + + # compile succeeds because inherit_condition is honored + compile_mappers() + def test_joined_inheritance(self): class Company(Base, ComparableEntity): __tablename__ = 'companies' |
