From 5c0d645353518ec632a1ece84d989890d2324eec Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 28 Nov 2010 13:07:00 -0500 Subject: [PATCH] - the "type_map" dictionary in sqlalchemy.types is now private, i.e. is named "_type_map". [ticket:1870] --- lib/sqlalchemy/sql/expression.py | 2 +- lib/sqlalchemy/types.py | 8 +++----- test/aaa_profiling/test_compiler.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 3cfe0a14c5..44adb76343 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2400,7 +2400,7 @@ class _BindParamClause(ColumnElement): _compared_to_type._coerce_compared_value( _compared_to_operator, value) else: - self.type = sqltypes.type_map.get(type(value), + self.type = sqltypes._type_map.get(type(value), sqltypes.NULLTYPE) elif isinstance(type_, type): self.type = type_() diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 782e9f15ea..13dbc6a831 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -18,7 +18,7 @@ __all__ = [ 'TypeEngine', 'TypeDecorator', 'AbstractType', 'UserDefinedType', 'String', 'Integer', 'SmallInteger', 'BigInteger', 'Numeric', 'Float', 'DateTime', 'Date', 'Time', 'LargeBinary', 'Binary', 'Boolean', 'Unicode', 'MutableType', 'Concatenable', - 'UnicodeText','PickleType', 'Interval', 'type_map', 'Enum' ] + 'UnicodeText','PickleType', 'Interval', 'Enum' ] import inspect import datetime as dt @@ -117,7 +117,7 @@ class AbstractType(Visitable): return self.__class__ def _coerce_compared_value(self, op, value): - _coerced_type = type_map.get(type(value), NULLTYPE) + _coerced_type = _type_map.get(type(value), NULLTYPE) if _coerced_type is NULLTYPE or _coerced_type._type_affinity \ is self._type_affinity: return self @@ -1930,10 +1930,8 @@ STRINGTYPE = String() # using VARCHAR/NCHAR so that we dont get the genericized "String" # type which usually resolves to TEXT/CLOB -# NOTE: this dict is not meant to be public and will be underscored -# in 0.7, see [ticket:1870]. -type_map = { +_type_map = { str: String(), # Py3K #bytes : LargeBinary(), diff --git a/test/aaa_profiling/test_compiler.py b/test/aaa_profiling/test_compiler.py index bc589c0b2f..160385e957 100644 --- a/test/aaa_profiling/test_compiler.py +++ b/test/aaa_profiling/test_compiler.py @@ -27,7 +27,7 @@ class CompileTest(TestBase, AssertsExecutionResults): for c in t.c: c.type._type_affinity from sqlalchemy import types - for t in types.type_map.values(): + for t in types._type_map.values(): t._type_affinity @profiling.function_call_count(69, {'2.4': 44, -- 2.47.2