diff options
| author | Johannes Erdfelt <johannes@erdfelt.com> | 2014-09-10 07:37:59 -0700 |
|---|---|---|
| committer | Johannes Erdfelt <johannes@erdfelt.com> | 2014-09-17 13:19:50 -0700 |
| commit | 7fa21b22989f6d53ff70a8df71fc6d210c556e07 (patch) | |
| tree | a6e8f1ee74213340de60d5852f8d10ad56bc212b /lib/sqlalchemy/dialects/mysql/base.py | |
| parent | 1f2f88d8ffaac5ae98de097e548e205778686cd5 (diff) | |
| download | sqlalchemy-7fa21b22989f6d53ff70a8df71fc6d210c556e07.tar.gz | |
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.
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 7ccd59abb..2f85a3626 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -2590,7 +2590,8 @@ class MySQLDialect(default.DefaultDialect): return [ { 'name': key['name'], - 'column_names': [col[0] for col in key['columns']] + 'column_names': [col[0] for col in key['columns']], + 'duplicates_index': key['name'], } for key in parsed_state.keys if key['type'] == 'UNIQUE' |
