Psycopg2 query returning Decimal('value')
what you're seeing is the repr()
of a decimal.Decimal()
value, which can precisely represent decimal values, a feature not available to float
s. There's no loss of utility, though, if you want to see a nice string representation, say, to 6 decimal places, just format it the way you would a float
, with str
or format
!
In [7]: str(decimal.Decimal('0.1'))
Out[7]: '0.1'
In [13]: "{0:0.6f}".format(decimal.Decimal('0.1'))
Out[13]: '0.100000'