summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.py
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes@erdfelt.com>2014-09-17 07:52:34 -0700
committerJohannes Erdfelt <johannes@erdfelt.com>2014-09-17 08:01:01 -0700
commit9d402e204d77da680472cbfb9813e437eb187944 (patch)
tree7be9fc6007ac44758ccfad05a1e64c046bb74a0f /test/dialect/test_sqlite.py
parenta985f84ed6223e7a7348dd6126f8de92012b635f (diff)
downloadsqlalchemy-9d402e204d77da680472cbfb9813e437eb187944.tar.gz
Handle sqlite get_unique_constraints() call for temporary tables
The sqlite get_unique_constraints() implementation did not do a union against the sqlite_temp_master table like other code does. This could result in an exception being raised if get_unique_constraints() was called against a temporary table.
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index e77a03980..6fc644689 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -575,6 +575,24 @@ class DialectTest(fixtures.TestBase, AssertsExecutionResults):
finally:
meta.drop_all()
+ def test_get_unique_constraints(self):
+ meta = MetaData(testing.db)
+ t1 = Table('foo', meta, Column('f', Integer),
+ UniqueConstraint('f', name='foo_f'))
+ t2 = Table('bar', meta, Column('b', Integer),
+ UniqueConstraint('b', name='bar_b'),
+ prefixes=['TEMPORARY'])
+ meta.create_all()
+ from sqlalchemy.engine.reflection import Inspector
+ try:
+ inspector = Inspector(testing.db)
+ eq_(inspector.get_unique_constraints('foo'),
+ [{'column_names': [u'f'], 'name': u'foo_f'}])
+ eq_(inspector.get_unique_constraints('bar'),
+ [{'column_names': [u'b'], 'name': u'bar_b'}])
+ finally:
+ meta.drop_all()
+
class SQLTest(fixtures.TestBase, AssertsCompiledSQL):