From a46932422b9bc7422e86b7d7db9fb753136730e0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 18 Jun 2014 10:56:23 -0400 Subject: - 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 --- lib/sqlalchemy/dialects/mysql/base.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/dialects/mysql') 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 -- cgit v1.2.1