Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'installed.': 0.07; 'postgresql': 0.07; 'table.': 0.07; 'alter': 0.09; 'postgresql,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sure,': 0.09; 'python': 0.11; 'wrote': 0.14; 'integer,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:n 70': 0.16; 'subject:dates': 0.16; 'subject:sqlite3': 0.16; 'worst': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'server,': 0.19; 'slightly': 0.19; 'seems': 0.21; 'feb': 0.22; 'features,': 0.24; 'looks': 0.24; 'header:X-Complaints-To:1': 0.27; 'ideal': 0.29; 'work.': 0.31; 'that.': 0.31; 'table,': 0.31; 'anyone': 0.31; 'quite': 0.32; 'becomes': 0.33; 'implemented': 0.33; 'maybe': 0.34; 'could': 0.34; 'basic': 0.35; 'case,': 0.35; 'but': 0.35; 'add': 0.35; 'really': 0.36; "didn't": 0.36; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'easy': 0.60; 'full': 0.61; 'back': 0.62; 'more': 0.64; 'offer,': 0.65; 'frank': 0.68; 'facilities': 0.69; 'surprise': 0.74; '2015': 0.84; 'column.': 0.84; 'demos': 0.84; '2015.': 0.91; 'magical': 0.91; 'businesses.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Frank Millman" Subject: Re: sqlite3 and dates Date: Wed, 18 Feb 2015 09:49:10 +0200 References: X-Gmane-NNTP-Posting-Host: 197.86.206.166 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.4657 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4913 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424245809 news.xs4all.nl 2842 [2001:888:2000:d::a6]:39790 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85774 "Chris Angelico" wrote in message news:CAPTjJmrB+55CVgN6zTUawRf=rzn9LTaVi5TzhJSYvHHywK1vOw@mail.gmail.com... > On Wed, Feb 18, 2015 at 5:19 PM, Frank Millman wrote: >> However, the following does not return a date object - >> >>>>> cur.execute('SELECT CAST(? AS DATE)', ('2015-03-31',)) >> >>>>> cur.fetchone() >> (2015,) >>>>> >> >> I don't know how easy this would be to implement, but it would be nice if >> it >> could be made to work. > > Heh! Looks like the date is implemented as a slightly magical integer, > so "cast to date" becomes "cast to integer" and you just get back > 2015. Could be really easy to fix, could be nigh impossible... but > sure, that seems a reasonable thing to ask for. Worst case, you get > told it's not practical. > > But if you need more facilities than SQLite3 can offer, maybe it's > time to move up to a full database server, instead of local files. > Switching to PostgreSQL will give you all those kinds of features, > plus a lot of other things that I would have thought pretty basic - > like ALTER TABLE. It was quite a surprise to learn that SQLite3 didn't > support that. > My accounting software supports three databases - MS Sql Server, PostgreSQL, and sqlite3. sqlite3 is not suitable for 'heavy-duty' applications, but it is ideal for demos and one-man businesses. Anyone can try out my software so long as they have python installed. They do not have to set up a database. sqlite3 does support ALTER TABLE, but with limited functionality. I think all you can do is add a column. Frank