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


Groups > comp.lang.python > #100262

Re: Problem with sqlite3 and Decimal (fwd)

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From "Frank Millman" <frank@chagford.com>
Newsgroups comp.lang.python
Subject Re: Problem with sqlite3 and Decimal (fwd)
Date Fri, 11 Dec 2015 16:27:27 +0200
Lines 42
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>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 83JVxrmv5Qf4YnOreXOHoQd9VIrLgLLVjx1k/7o0bwOA==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'emulate': 0.07; 'subject:sqlite3': 0.07; 'type,': 0.07; 'lines:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'oddity': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reproduce': 0.16; 'skip:n 70': 0.16; 'sqlite3': 0.16; 'subject:Problem': 0.16; 'string,': 0.18; 'windows': 0.20; '2015': 0.20; '+0200': 0.20; 'wrote': 0.23; 'dec': 0.23; 'header:In-Reply- To:1': 0.24; 'header:X-Complaints-To:1': 0.26; 'supported': 0.27; 'fri,': 0.27; 'arithmetic': 0.29; 'decimal': 0.29; 'directly,': 0.29; 'objects': 0.29; 'date:': 0.31; 'post': 0.31; 'noticed': 0.32; 'maybe': 0.33; 'problem': 0.33; 'info': 0.34; 'could': 0.35; 'something': 0.35; 'subject:': 0.35; 'asking': 0.35; 'but': 0.36; 'there': 0.36; 'email addr:python.org': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'list.': 0.37; 'mailing': 0.38; 'hi,': 0.38; 'data': 0.39; 'from:': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'save': 0.60; 'skip:u 10': 0.61; 'back': 0.62; 'email name:python-list': 0.67; 'saving': 0.70; 'frank': 0.72; 'article': 0.77; '3.4': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 197.89.230.120
In-Reply-To <CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=E+Q@mail.gmail.com>
X-MSMail-Priority Normal
Importance Normal
X-Newsreader Microsoft Windows Live Mail 15.4.3502.922
X-MimeOLE Produced By Microsoft MimeOLE V15.4.3502.922
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100262

Show key headers only | 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