:ref:`change_floats_12`
+ .. change:: 4020
+ :tags: bug, sql, mysql
+ :tickets: 4020
+
+ The result processor for the :class:`.Float` type now unconditionally
+ runs values through the ``float()`` processor if the dialect
+ specifies that it also supports "native decimal" mode. While most
+ backends will deliver Python ``float`` objects for a floating point
+ datatype, the MySQL backends in some cases lack the typing information
+ in order to provide this and return ``Decimal`` unless the float
+ conversion is done.
+
+ .. seealso::
+
+ :ref:`change_floats_12`
+
.. change:: 4017
:tags: bug, sql
:tickets: 4017
expr = column('a', Integer) * column('b', Float())
assert isinstance(expr.type, Float)
+* The :class:`.Float` datatype will apply the ``float()`` processor to
+ result values unconditionally if the DBAPI is known to support native
+ ``Decimal()`` mode. Some backends do not always guarantee that a floating
+ point number comes back as plain float and not precision numeric such
+ as MySQL.
:ticket:`4017`
+:ticket:`4018`
+
+:ticket:`4020`
+
Key Behavioral Changes - ORM
============================
return processors.to_decimal_processor_factory(
decimal.Decimal,
self._effective_decimal_return_scale)
+ elif dialect.supports_native_decimal:
+ return processors.to_float
else:
return None
filter_=lambda n: n is not None and round(n, 5) or None
)
- @testing.fails_on("mysql", "until we do #4020")
def test_float_coerce_round_trip(self):
expr = 15.7563