diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2016-04-11 17:01:42 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-06-01 12:57:36 -0400 |
commit | a8e7bb8782ca8fd858ac036082104b4ac2991cfc (patch) | |
tree | c3b2a3c1e68b364e33feacd91221b405c6ad737f /test/engine/test_reflection.py | |
parent | 3f55039e7f15efafacc3e8e0fbf0ba38fa612b09 (diff) | |
download | sqlalchemy-a8e7bb8782ca8fd858ac036082104b4ac2991cfc.tar.gz |
Implemented CHECK constraint reflection for SQLite and PostgreSQL
Co-Authored-By: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: Ie6cf2d2958d1c567324db9e08fef2d3186e97350
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/80
Diffstat (limited to 'test/engine/test_reflection.py')
-rw-r--r-- | test/engine/test_reflection.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py index 1dc65d7d0..62568eb4a 100644 --- a/test/engine/test_reflection.py +++ b/test/engine/test_reflection.py @@ -981,6 +981,26 @@ class ReflectionTest(fixtures.TestBase, ComparesTables): assert set([t2.c.name, t2.c.id]) == set(r2.columns) assert set([t2.c.name]) == set(r3.columns) + @testing.requires.check_constraint_reflection + @testing.provide_metadata + def test_check_constraint_reflection(self): + m1 = self.metadata + Table( + 'x', m1, + Column('q', Integer), + sa.CheckConstraint('q > 10', name="ck1") + ) + m1.create_all() + m2 = MetaData(testing.db) + t2 = Table('x', m2, autoload=True) + + ck = [ + const for const in + t2.constraints if isinstance(const, sa.CheckConstraint)][0] + + eq_(ck.sqltext.text, "q > 10") + eq_(ck.name, "ck1") + @testing.provide_metadata def test_index_reflection_cols_busted(self): t = Table('x', self.metadata, |