]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added optional '=' to MySQL KEY_BLOCK_SIZE regex
authorW. Sean McGivern <WSMcGivern@gmail.com>
Sat, 19 Apr 2014 16:16:46 +0000 (12:16 -0400)
committerW. Sean McGivern <WSMcGivern@gmail.com>
Sat, 19 Apr 2014 16:16:46 +0000 (12:16 -0400)
lib/sqlalchemy/dialects/mysql/base.py
test/dialect/mysql/test_reflection.py

index ba6e7b62587fc7901316803387f386e1438262a3..85cbd6e2232d5224f1d0960d1cf092b78c93e3d7 100644 (file)
@@ -2951,7 +2951,7 @@ class MySQLTableDefinitionParser(object):
             r'(?: +USING +(?P<using_pre>\S+))?'
             r' +\((?P<columns>.+?)\)'
             r'(?: +USING +(?P<using_post>\S+))?'
-            r'(?: +KEY_BLOCK_SIZE +(?P<keyblock>\S+))?'
+            r'(?: +KEY_BLOCK_SIZE *[ =]? *(?P<keyblock>\S+))?'
             r'(?: +WITH PARSER +(?P<parser>\S+))?'
             r',?$'
             % quotes
index 7494eaf4315898aa5c28a9ab772c4d557a49f2c8..c8fdc9310bca825060c8de3aac6a0444c576f850 100644 (file)
@@ -297,6 +297,10 @@ class RawReflectionTest(fixtures.TestBase):
         assert regex.match('  PRIMARY KEY (`id`)')
         assert regex.match('  PRIMARY KEY USING BTREE (`id`)')
         assert regex.match('  PRIMARY KEY (`id`) USING BTREE')
+        assert regex.match('  PRIMARY KEY (`id`) USING BTREE KEY_BLOCK_SIZE 16')
+        assert regex.match('  PRIMARY KEY (`id`) USING BTREE KEY_BLOCK_SIZE=16')
+        assert regex.match('  PRIMARY KEY (`id`) USING BTREE KEY_BLOCK_SIZE  = 16')
+        assert not regex.match('  PRIMARY KEY (`id`) USING BTREE KEY_BLOCK_SIZE = = 16')
 
     def test_fk_reflection(self):
         regex = self.parser._re_constraint