- changed status to resolved
normalize all Numeric types to return Decimal
Issue #646
resolved
first, confirm that psycopg2 does in fact return Decimal objects for postgres numeric types. then, modify types.Numeric to perform this conversion for everyone else who normally returns a float. the PGNumeric type will override convert_bind_param() and convert_result_value() to do nothing.
Comments (5)
-
reporter -
- removed status
- changed status to open
Python 2.3 doesn't have Decimal- need to decide whether to pull this or not.
-
reporter 6b7f670c4ccb6a2c45a6da459ed29b07784498b0 should fix this....safe to close ?
-
reporter - changed status to resolved
confirmed, we'll have "fallback" to float on 2.3, 2.4's get a Decimal back for Numeric types.
-
reporter - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
implemented for sqlite, pg and mysql in changeset:3030. both pg and mysql were already following the behavior of Numeric to return Decimal, Float to return float(). an "asdecimal" flag was added so that both Numeric and Float can return either, while still retaining the default behavior of Decimal/float for Numeric/Float, getting it to work on sqlite too. both Decimal/float are accepted for all Numeric/Float types as bind parameters at all times (again, only sqlite needed this).
when the test suite is run for oracle, mssql, firebird, and informix, those dialects can be adjusted to suite the Numeric test in test/sql/testtypes.py.