From 6b79d2ea7951abc2bb6083b541db0fbf71590dd3 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 22 Nov 2013 20:04:19 -0500 Subject: - The precision used when coercing a returned floating point value to Python ``Decimal`` via string is now configurable. The flag ``decimal_return_scale`` is now supported by all :class:`.Numeric` and :class:`.Float` types, which will ensure this many digits are taken from the native floating point value when it is converted to string. If not present, the type will make use of the value of ``.scale``, if the type supports this setting and it is non-None. Otherwise the original default length of 10 is used. [ticket:2867] --- lib/sqlalchemy/dialects/oracle/cx_oracle.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/sqlalchemy/dialects/oracle') diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index d59aab8f7..0c6d257dc 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -232,10 +232,7 @@ class _OracleNumeric(sqltypes.Numeric): if dialect.supports_native_decimal: if self.asdecimal: - if self.scale is None: - fstring = "%.10f" - else: - fstring = "%%.%df" % self.scale + fstring = "%%.%df" % self.decimal_return_scale def to_decimal(value): if value is None: -- cgit v1.2.1