diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-06-18 10:56:23 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-06-18 10:56:23 -0400 |
commit | a46932422b9bc7422e86b7d7db9fb753136730e0 (patch) | |
tree | 91d1f03bf3149ec1527b70ae91f2d321c1d335fe /lib/sqlalchemy/dialects/mysql/base.py | |
parent | 33cb84945f5277a3cf090b73b218abc583d292fc (diff) | |
download | sqlalchemy-a46932422b9bc7422e86b7d7db9fb753136730e0.tar.gz |
- Fixed bug where column names added to ``mysql_length`` parameter
on an index needed to have the same quoting for quoted names in
order to be recognized. The fix makes the quotes optional but
also provides the old behavior for backwards compatibility with those
using the workaround.
fixes #3085
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 40715cc31..6d8b6a07c 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -1725,9 +1725,13 @@ class MySQLDDLCompiler(compiler.DDLCompiler): # length value can be a (column_name --> integer value) mapping # specifying the prefix length for each column of the index columns = ', '.join( - ('%s(%d)' % (col, length[col]) - if col in length else '%s' % col) - for col in columns + '%s(%d)' % (expr, length[col.name]) if col.name in length + else + ( + '%s(%d)' % (expr, length[expr]) if expr in length + else '%s' % expr + ) + for col, expr in zip(index.expressions, columns) ) else: # or can be an integer value specifying the same |