def _tokenize_column_type(self, column):
definition = self.dialect.type_compiler.process(column.type).lower()
- # py27 - py36 - col_type, *param_terms = re.findall...
- matches = re.findall("[^(),]+", definition)
- col_type, param_terms = matches[0], matches[1:]
+ matches = re.search(
+ r"^(?P<col>[^()]*)(?:\((?P<params>.*?)\))?(?P<ext>[^()]*)?$",
+ definition,
+ ).groupdict(default="")
+ col_type = matches["col"]
+ if matches["ext"]:
+ col_type = col_type.strip() + " " + matches["ext"].strip()
params = Params(col_type, [], {})
- for term in param_terms:
+ for term in matches["params"].split(",") if matches["params"] else []:
if "=" in term:
key, val = term.split("=")
params.kwargs[key.strip()] = val.strip()
from sqlalchemy import Unicode
from sqlalchemy import UniqueConstraint
from sqlalchemy import VARCHAR
+from sqlalchemy.dialects import mysql
from sqlalchemy.dialects import sqlite
from sqlalchemy.types import NULLTYPE
from sqlalchemy.types import VARBINARY
True,
config.requirements.integer_subtype_comparisons,
),
+ (
+ mysql.INTEGER(unsigned=True, display_width=10),
+ mysql.INTEGER(unsigned=True, display_width=10),
+ False,
+ ),
+ (mysql.INTEGER(unsigned=True), mysql.INTEGER(unsigned=True), False),
+ (
+ mysql.INTEGER(unsigned=True, display_width=10),
+ mysql.INTEGER(unsigned=True),
+ False,
+ ),
+ (
+ mysql.INTEGER(unsigned=True),
+ mysql.INTEGER(unsigned=True, display_width=10),
+ False,
+ ),
)
def test_numeric_comparisons(self, cola, colb, expect_changes):
is_(self._compare_columns(cola, colb), expect_changes)