Problem with sqlite3 and Decimal

Chris Angelico rosuav at gmail.com
Sun Dec 13 00:04:38 EST 2015


On Sun, Dec 13, 2015 at 4:00 PM, Frank Millman <frank at chagford.com> wrote:
> My new solution is to pass a 'scale' factor into my aggregate function. The
> function uses the Decimal quantize method to round the result before
> returning. So far it seems to be working.

So, effectively, you're using fixed point arithmetic. As long as
you're restricting yourself to adding values together, that's easy; be
careful of multiplying by tax percentages, as you might flick to
float.

Really, you'd do a lot better to move to PostgreSQL.

ChrisA



More information about the Python-list mailing list