[PyGreSQL] DECIMAL to float, alternatives?

Gerald Forster gfnews at aon.at
Wed Jan 31 13:48:04 EST 2007


Christoph Zwerschke schrieb:
>> when accessing PostgreSQL with pgdb, DECIMAL values in the database 
>> are provided as floats in Python. Is it possible to get huge DECIMAL 
>> values without losing precision?
> 
> Not directly, but you can of course cast the DECIMAL to TEXT in your
> query, and then do with the string whatever you want in Python, e.g.
> convert it to a Decimal. It has probably never been implemented since it
> was only introduced in Python 2.4.

Thank you Chris!

Casting works. Great!!!

Best regards
Gerald



More information about the PyGreSQL mailing list