--- /dev/null
+.. change::
+ :tags: bug, sqlite
+ :tickets: 8866
+
+ Backported a fix for SQLite reflection of unique constraints in attached
+ schemas, released in 2.0 as a small part of :ticket:`4379`. Previously,
+ unique constraints in attached schemas would be ignored by SQLite
+ reflection. Pull request courtesy Michael Gorven.
# loop thru unique indexes to get the column names.
for idx in list(indexes):
pragma_index = self._get_table_pragma(
- connection, "index_info", idx["name"]
+ connection, "index_info", idx["name"], schema=schema
)
for row in pragma_index:
Table(
"another_created",
meta,
- Column("bat", Integer),
+ Column("bat", Integer, unique=True),
Column("hoho", String),
schema="test_schema",
)
{"created", "another_created"},
)
+ def test_unique_constraints(self):
+ self._fixture()
+ insp = inspect(self.conn)
+ eq_(
+ [
+ d["column_names"]
+ for d in insp.get_unique_constraints(
+ "created", schema="test_schema"
+ )
+ ],
+ [],
+ )
+ eq_(
+ [
+ d["column_names"]
+ for d in insp.get_unique_constraints(
+ "another_created", schema="test_schema"
+ )
+ ],
+ [["bat"]],
+ )
+
def test_schema_names(self):
self._fixture()
insp = inspect(self.conn)