pg8000 adapter doesn't send native Numerics
Issue #2132
resolved
class _PGNumeric in pg8000.py needs these lines to turn on sending of Numerics:
def bind_processor(self, dialect):
return None
psycopg2.py has the same code. If this code is not present, sqltypes.Numeric will force conversion to float instead of passing a decimal.Decimal.
pg8000 1.08 appears to have a bug where it truncates decimals after the decimal point. See also https://github.com/mfenniak/pg8000/issues/7 for this bug.
Comments (4)
-
repo owner -
repo owner - changed milestone to 0.7.0
-
repo owner - changed status to resolved
f9113b5dbfe5fec59759b1018465e729f6741167 adds an exception for when FLOAT is used. pg8000 is sensitive to the declared type in the database so this approach seems to cover all the bases. Thanks for the patch !
-
repo owner - removed milestone
Removing milestone: 0.7.0 (automated comment)
- Log in to comment
the patch as is causes float coercion to fail, in a way that does not occur with psycopg2:
an adjustment is to disable bind processing for Numeric but not Float. I have a patch here that accomplishes that.