summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/session.py
diff options
context:
space:
mode:
authorGord Thompson <gord@gordthompson.com>2020-12-20 10:20:10 -0700
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-20 23:18:04 -0500
commit3b8a14153da9e7b6694571fa10f6d30c4012ee82 (patch)
tree89c26616a9088bad7c9c0c195fa96fcc24b5fe13 /lib/sqlalchemy/ext/asyncio/session.py
parenta8f51f3c11f3cb2e344732cf3abb371f03ed30d8 (diff)
downloadsqlalchemy-3b8a14153da9e7b6694571fa10f6d30c4012ee82.tar.gz
Fix issues with JSON and float/numeric
Decimal accuracy and behavior has been improved when extracting floating point and/or decimal values from JSON strings using the :meth:`_sql.sqltypes.JSON.Comparator.as_float` method, when the numeric value inside of the JSON string has many significant digits; previously, MySQL backends would truncate values with many significant digits and SQL Server backends would raise an exception due to a DECIMAL cast with insufficient significant digits. Both backends now use a FLOAT-compatible approach that does not hardcode significant digits for floating point values. For precision numerics, a new method :meth:`_sql.sqltypes.JSON.Comparator.as_numeric` has been added which accepts arguments for precision and scale, and will return values as Python ``Decimal`` objects with no floating point conversion assuming the DBAPI supports it (all but pysqlite). Fixes: #5788 Change-Id: I6eb51fe172a389548dd6e3c65efec9f1f538012e
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
0 files changed, 0 insertions, 0 deletions