diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-05-23 16:22:48 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-05-25 10:29:10 -0400 |
| commit | 6c27bf5048fc7335a1d1fdd49b651b1a164b8e32 (patch) | |
| tree | 3b447956383f636fa42d343fe5d816ac196ef5bc /lib/sqlalchemy/sql | |
| parent | c7ae04d1c5c4aa6c6099584ae386d6ab9ef7b290 (diff) | |
| download | sqlalchemy-6c27bf5048fc7335a1d1fdd49b651b1a164b8e32.tar.gz | |
Turn oracle BINARY_DOUBLE, BINARY_FLOAT, DOUBLE_PRECISION into floats
The Oracle BINARY_FLOAT and BINARY_DOUBLE datatypes now participate within
cx_Oracle.setinputsizes(), passing along NATIVE_FLOAT, so as to support the
NaN value. Additionally, :class:`.oracle.BINARY_FLOAT`,
:class:`.oracle.BINARY_DOUBLE` and :class:`.oracle.DOUBLE_PRECISION` now
subclass :class:`.Float`, since these are floating point datatypes, not
decimal. These datatypes were already defaulting the
:paramref:`.Float.asdecimal` flag to False in line with what
:class:`.Float` already does.
Added reflection capabilities for the :class:`.oracle.BINARY_FLOAT`,
:class:`.oracle.BINARY_DOUBLE` datatypes.
Change-Id: Id99b912e83052654a17d07dc92b4dcb958cb7600
Fixes: #4264
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/type_api.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 1d1d6e089..6a323683b 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -445,6 +445,20 @@ class TypeEngine(Visitable): except KeyError: return self._dialect_info(dialect)['impl'] + def _unwrapped_dialect_impl(self, dialect): + """Return the 'unwrapped' dialect impl for this type. + + For a type that applies wrapping logic (e.g. TypeDecorator), give + us the real, actual dialect-level type that is used. + + This is used by TypeDecorator itself as well at least one case where + dialects need to check that a particular specific dialect-level + type is in use, within the :meth:`.DefaultDialect.set_input_sizes` + method. + + """ + return self.dialect_impl(dialect) + def _cached_literal_processor(self, dialect): """Return a dialect-specific literal processor for this type.""" try: @@ -922,7 +936,7 @@ class TypeDecorator(SchemaEventTarget, TypeEngine): # otherwise adapt the impl type, link # to a copy of this TypeDecorator and return # that. - typedesc = self.load_dialect_impl(dialect).dialect_impl(dialect) + typedesc = self._unwrapped_dialect_impl(dialect) tt = self.copy() if not isinstance(tt, self.__class__): raise AssertionError('Type object %s does not properly ' @@ -989,6 +1003,20 @@ class TypeDecorator(SchemaEventTarget, TypeEngine): """ return self.impl + def _unwrapped_dialect_impl(self, dialect): + """Return the 'unwrapped' dialect impl for this type. + + For a type that applies wrapping logic (e.g. TypeDecorator), give + us the real, actual dialect-level type that is used. + + This is used by TypeDecorator itself as well at least one case where + dialects need to check that a particular specific dialect-level + type is in use, within the :meth:`.DefaultDialect.set_input_sizes` + method. + + """ + return self.load_dialect_impl(dialect).dialect_impl(dialect) + def __getattr__(self, key): """Proxy all other undefined accessors to the underlying implementation.""" |
