summaryrefslogtreecommitdiff
path: root/test/sql/test_constraints.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-25 13:20:43 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-25 13:20:43 -0500
commita7f766d7c7fd6c53eb0019e32569e915b3f31eb4 (patch)
tree25f6234f67bbea40bb95eb34572bd2f67136e33f /test/sql/test_constraints.py
parent34d6c9bc7dafbb2717ae10b6e11942e2dd409f35 (diff)
downloadsqlalchemy-a7f766d7c7fd6c53eb0019e32569e915b3f31eb4.tar.gz
- establish an "insert" option for events to control ordering if needed (not needed yet tho)
- render foreign key constraints in the order in which they were cerated
Diffstat (limited to 'test/sql/test_constraints.py')
-rw-r--r--test/sql/test_constraints.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py
index 1c13a0ec7..c5433fa9c 100644
--- a/test/sql/test_constraints.py
+++ b/test/sql/test_constraints.py
@@ -322,6 +322,28 @@ class ConstraintCompilationTest(TestBase, AssertsCompiledSQL):
factory = lambda **kw: CheckConstraint('a < b', **kw)
self._test_deferrable(factory)
+ def test_multiple(self):
+ m = MetaData()
+ foo = Table("foo", m,
+ Column('id', Integer, primary_key=True),
+ Column('bar', Integer, primary_key=True)
+ )
+ tb = Table("some_table", m,
+ Column('id', Integer, primary_key=True),
+ Column('foo_id', Integer, ForeignKey('foo.id')),
+ Column('foo_bar', Integer, ForeignKey('foo.bar')),
+ )
+ self.assert_compile(
+ schema.CreateTable(tb),
+ "CREATE TABLE some_table ("
+ "id INTEGER NOT NULL, "
+ "foo_id INTEGER, "
+ "foo_bar INTEGER, "
+ "PRIMARY KEY (id), "
+ "FOREIGN KEY(foo_id) REFERENCES foo (id), "
+ "FOREIGN KEY(foo_bar) REFERENCES foo (bar))"
+ )
+
def test_deferrable_column_check(self):
t = Table('tbl', MetaData(),
Column('a', Integer),