]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Reflect unique constraints when reflecting a Table object
authorJohannes Erdfelt <johannes@erdfelt.com>
Wed, 10 Sep 2014 14:37:59 +0000 (07:37 -0700)
committerJohannes Erdfelt <johannes@erdfelt.com>
Wed, 17 Sep 2014 20:19:50 +0000 (13:19 -0700)
commit7fa21b22989f6d53ff70a8df71fc6d210c556e07
treea6e8f1ee74213340de60d5852f8d10ad56bc212b
parent1f2f88d8ffaac5ae98de097e548e205778686cd5
Reflect unique constraints when reflecting a Table object

Calls to reflect a table did not create any UniqueConstraint objects.
The reflection core made no calls to get_unique_constraints and as
a result, the sqlite dialect would never reflect any unique constraints.

MySQL transparently converts unique constraints into unique indexes, but
SQLAlchemy would reflect those as an Index object and as a
UniqueConstraint. The reflection core will now deduplicate the unique
constraints.

PostgreSQL would reflect unique constraints as an Index object and as
a UniqueConstraint object. The reflection core will now deduplicate
the unique indexes.
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/testing/suite/test_reflection.py
test/dialect/mysql/test_reflection.py
test/dialect/postgresql/test_reflection.py