[Sqlalchemy-tickets] Issue #4260: PGDialect should support native decimal (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: pachewise <iss...@bi...> - 2018-05-19 00:08:09
|
New issue 4260: PGDialect should support native decimal https://bitbucket.org/zzzeek/sqlalchemy/issues/4260/pgdialect-should-support-native-decimal pachewise: supports_native_decimal is set to False by default, but postgres (and dialects derived from it, like Vertica) has support for Decimal/Numeric. I submitted a PR for the particular dialect we use at work (https://github.com/LocusEnergy/sqlalchemy-vertica-python/pull/18), but thought it made sense to propose the change here, too. Test case: ``` >> import decimal; decimal.Decimal(float(-6054546742273406781)) Decimal('-6054546742273406976') ``` (0) Have a table with a Decimal(19, 0) or Numeric(19, 0) column (or any precision > 16) (1) Add a value like -6054546742273406781, which uses all the sig figs (2) Do a select on that table; you'll see an SAWarning regarding decimal -> float conversion, and precision loss when it comes back as Decimal (-6054546742273406976) using Ubuntu 14.04.5, Python 2.7.12 |