[Zope] ZSQL Method's Precision

Tino Wildenhain tino at wildenhain.de
Tue Oct 24 04:08:13 EDT 2006

Maciej Wisniowski schrieb:
>> In a PostgreSQL DB I have a Numeric data type with a precision of two
>> decimal places. If I have 1.33 in as the result from my query, it's
>> everything is good. However, if I have 1.30 it reduces the precision
>> to one decimal place and I get 1.3. Not so good when dealing with
>> currency ( I don't want to use the money data dype ).
>> Any ideas on how I can get my ZSQL method to keep two decimal places?
> As others said it's a matter of displaying. You say that you don't want
> to use money datatype but keep in mind that postgre adapter
> is able to use Python's Decimal datatype for money values (in python2.3
> you need additional module decimal.py from Python 2.4 to enable it)
> which may give you necessary precision for financial operations and is
> able to store really big numbers.

The adaptor should use it for numeric data as well (hey, hence the name 
;) Use of the deprecated money datatype in postgres isnt recommended.
(And its superceeded by numeric anyway)

Tino Wildenhain

More information about the Zope mailing list