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


Groups > comp.lang.python > #85774 > unrolled thread

Re: sqlite3 and dates

Started by"Frank Millman" <frank@chagford.com>
First post2015-02-18 09:49 +0200
Last post2015-02-18 09:49 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: sqlite3 and dates "Frank Millman" <frank@chagford.com> - 2015-02-18 09:49 +0200

#85774 — Re: sqlite3 and dates

From"Frank Millman" <frank@chagford.com>
Date2015-02-18 09:49 +0200
SubjectRe: sqlite3 and dates
Message-ID<mailman.18808.1424245809.18130.python-list@python.org>
"Chris Angelico" <rosuav@gmail.com> wrote in message 
news:CAPTjJmrB+55CVgN6zTUawRf=rzn9LTaVi5TzhJSYvHHywK1vOw@mail.gmail.com...
> On Wed, Feb 18, 2015 at 5:19 PM, Frank Millman <frank@chagford.com> wrote:
>> However, the following does not return a date object -
>>
>>>>> cur.execute('SELECT CAST(? AS DATE)', ('2015-03-31',))
>> <sqlite3.Cursor object at 0x00FE9BE0>
>>>>> 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


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web