Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100262

Re: Problem with sqlite3 and Decimal (fwd)

From "Frank Millman" <frank@chagford.com>
Newsgroups comp.lang.python
Subject Re: Problem with sqlite3 and Decimal (fwd)
Date 2015-12-11 16:27 +0200
Message-ID <mailman.139.1449844062.12405.python-list@python.org> (permalink)
References <201512111345.tBBDjgae025001@fido.openend.se> <CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=E+Q@mail.gmail.com>

Show all headers | View raw


"Igor Korot"  wrote in message 
news:CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=E+Q@mail.gmail.com...

> Hi,
>
> > To: python-list@python.org
> > From: "Frank Millman" <frank@chagford.com>
> > Subject: Problem with sqlite3 and Decimal
> > Date: Fri, 11 Dec 2015 11:21:53 +0200
> > Lines: 71
> >
> > Hi all
> >
> > I need to store Decimal objects in a sqlite3 database, using Python 3.4 
> > on
> > Windows 7.
> >
[...]
>
> >
> > I noticed one oddity - I am asking sqlite3 to store the value as a 
> > string,
> > but then I am asking it to perform arithmetic on it.
>
> Is there a reason you are saving it as the string?
> What happens when you save it as decimal?
>

Well, maybe you know something that I don't, but my understanding is that 
sqlite3 has a very limited range of supported data types, and decimal is not 
one of them.

The stackoverflow article explains how to emulate a decimal type, and it 
works well most of the time.

I found that I could reproduce the problem using sqlite3 directly, without 
using Python, so I have sent a post to the sqlite3 mailing list. I will 
report back with any info received.

Frank

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with sqlite3 and Decimal (fwd) "Frank Millman" <frank@chagford.com> - 2015-12-11 16:27 +0200

csiph-web