summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/reflection.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-04-08 20:26:21 +0200
committerFederico Caselli <cfederico87@gmail.com>2020-04-09 00:33:22 +0200
commita9b068ae564e5e775e312373088545b75aeaa1b0 (patch)
tree3a20c79acfefe49b62ee4bca360bb11001f9eec9 /lib/sqlalchemy/dialects/mysql/reflection.py
parentecca4fe3f8aebc5b42c2acda2e5d28d6a90a821e (diff)
downloadsqlalchemy-a9b068ae564e5e775e312373088545b75aeaa1b0.tar.gz
Remove code deprecated before version 1.1
- Remove deprecated method ``get_primary_keys` in the :class:`.Dialect` and :class:`.Inspector` classes. - Remove deprecated event ``dbapi_error`` and the method ``ConnectionEvents.dbapi_error`. - Remove support for deprecated engine URLs of the form ``postgres://``. - Remove deprecated dialect ``mysql+gaerdbms``. - Remove deprecated parameter ``quoting`` from :class:`.mysql.ENUM` and :class:`.mysql.SET` in the ``mysql`` dialect. - Remove deprecated function ``comparable_property``. and function ``comparable_using`` in the declarative extension. - Remove deprecated function ``compile_mappers``. - Remove deprecated method ``collection.linker``. - Remove deprecated method ``Session.prune`` and parameter ``Session.weak_identity_map``. This change also removes the class ``StrongInstanceDict``. - Remove deprecated parameter ``mapper.order_by``. - Remove deprecated parameter ``Session._enable_transaction_accounting`. - Remove deprecated parameter ``Session.is_modified.passive``. - Remove deprecated class ``Binary``. Please use :class:`.LargeBinary`. - Remove deprecated methods ``Compiled.compile``, ``ClauseElement.__and__`` and ``ClauseElement.__or__`` and attribute ``Over.func``. - Remove deprecated ``FromClause.count`` method. - Remove deprecated parameter ``Table.useexisting``. - Remove deprecated parameters ``text.bindparams`` and ``text.typemap``. - Remove boolean support for the ``passive`` parameter in ``get_history``. - Remove deprecated ``adapt_operator`` in ``UserDefinedType.Comparator``. Fixes: #4643 Change-Id: Idcd390c77bf7b0e9957907716993bdaa3f1a1763
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/reflection.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/reflection.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/reflection.py b/lib/sqlalchemy/dialects/mysql/reflection.py
index 8aeb1dc96..5be6a010e 100644
--- a/lib/sqlalchemy/dialects/mysql/reflection.py
+++ b/lib/sqlalchemy/dialects/mysql/reflection.py
@@ -7,7 +7,7 @@
import re
-from .enumerated import _EnumeratedValues
+from .enumerated import ENUM
from .enumerated import SET
from .types import DATETIME
from .types import TIME
@@ -215,8 +215,8 @@ class MySQLTableDefinitionParser(object):
for kw in ("charset", "collate"):
if spec.get(kw, False):
type_kw[kw] = spec[kw]
- if issubclass(col_type, _EnumeratedValues):
- type_args = _EnumeratedValues._strip_values(type_args)
+ if issubclass(col_type, (ENUM, SET)):
+ type_args = _strip_values(type_args)
if issubclass(col_type, SET) and "" in type_args:
type_kw["retrieve_as_bitwise"] = True
@@ -545,3 +545,14 @@ def _re_compile(regex):
"""Compile a string to regex, I and UNICODE."""
return re.compile(regex, re.I | re.UNICODE)
+
+
+def _strip_values(values):
+ "Strip reflected values quotes"
+ strip_values = []
+ for a in values:
+ if a[0:1] == '"' or a[0:1] == "'":
+ # strip enclosing quotes and unquote interior
+ a = a[1:-1].replace(a[0] * 2, a[0])
+ strip_values.append(a)
+ return strip_values