Re: [sqlite] date field with default current date

2011-05-23 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05/23/2011 08:46 AM, Fabio Spadaro wrote:
> Hi

When you quote other messages, only quote the relevant pieces that you are
replying to.  Several hundred lines is not appropriate.

> What is the difference between "sqlite3.version" (typed on command
> line) and "SELECT
> sqlite_version()" because one gives a value like 2.4.1 and the other gives
> as the value 3.5.9 ?

The former is the version of pysqlite (the Python wrapper for SQLite you are
using) and the latter is the version of the SQLite library.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk3amUoACgkQmOOfHg372QRalACfVLjxmL1auZxTBGkC1F19WHs2
DZEAn04yP8MHYFrgoXN9DCrEjEbHbron
=DXD3
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-05-23 Thread Jean-Christophe Deschamps

>   I resolved with:
>CREATE TRIGGER insert_nameTable after insert on 
>name_tabl  begin
>update  set ww = datetime('now','localtime')
>where rowid = new.rowid; end"

You don't have to fire a trigger for such default:
CREATE TABLE "test" (
   "mydate" CHAR DEFAULT (datetime('now','localtime')),
   "data" CHAR);
insert into test (data) values ('abc');

>What is the difference between "sqlite3.version" (typed on command
>line) and "SELECT
>sqlite_version()" because one gives a value like 2.4.1 and the other gives
>as the value 3.5.9 ?

An outdated command-line utility?

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-05-23 Thread Fabio Spadaro
Hi

2011/4/22 Pavel Ivanov 

> > In my system is set up with 11:35:07 while I am in the data 9:37:30
> > Why?
>
> http://www.sqlite.org/lang_createtable.html
> "If the default value of a column is CURRENT_TIME, CURRENT_DATE or
> CURRENT_TIMESTAMP, then the value used in the new row is a text
> representation of the current UTC date and/or time."
>
> It won't be your local time.
>
>
> Pavel
>
>
> On Fri, Apr 22, 2011 at 5:46 AM, Fabio Spadaro 
> wrote:
> > Hi.
> >
> > 2011/4/22 Fabio Spadaro 
> >
> >> Hi
> >>
> >>
> >> 2011/4/22 Fabio Spadaro 
> >>
> >>> Hi.
> >>>
> >>>
> >>> 2011/4/22 Pavel Ivanov 
> >>>
> >>>> >> What does "SELECT sqlite_version()" gives you in python with
> sqlite3
> >>>> >> module?
> >>>> > [(u'3.5.9',)]
> >>>>
> >>>> Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
> >>>> show us an exact statement you are trying to execute and the exact
> >>>> text of error you get?
> >>>>
> >>>>
> >>>> Pavel
> >>>>
> >>>>
> >>>> On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro <
> fabiolinos...@gmail.com>
> >>>> wrote:
> >>>> > Hi.
> >>>> >
> >>>> > 2011/4/21 Pavel Ivanov 
> >>>> >
> >>>> >> > Does not work on python with sqlite3 module
> >>>> >>
> >>>> >> What does "SELECT sqlite_version()" gives you in python with
> sqlite3
> >>>> >> module?
> >>>> >>
> >>>> >>
> >>>> >> Pavel
> >>>> >>
> >>>> >>
> >>>> >> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro <
> >>>> fabiolinos...@gmail.com>
> >>>> >> wrote:
> >>>> >> > Hi.
> >>>> >> >
> >>>> >> > 2011/4/21 Black, Michael (IS) 
> >>>> >> >
> >>>> >> >> create table t (d default CURRENT_DATE,i number);
> >>>> >> >> insert into t (i) values(1);
> >>>> >> >> select * from t;
> >>>> >> >> 2011-04-21|1
> >>>> >> >>
> >>>> >> >>
> >>>> >> >>
> >>>> >> >> Use CURRENT_TIME if you want hours/minutes too.
> >>>> >> >>
> >>>> >> >>
> >>>> >> >>
> >>>> >> >> Michael D. Black
> >>>> >> >>
> >>>> >> >> Senior Scientist
> >>>> >> >>
> >>>> >> >> NG Information Systems
> >>>> >> >>
> >>>> >> >> Advanced Analytics Directorate
> >>>> >> >>
> >>>> >> >>
> >>>> >> >>
> >>>> >> >> 
> >>>> >> >> From: sqlite-users-boun...@sqlite.org [
> >>>> sqlite-users-boun...@sqlite.org]
> >>>> >> on
> >>>> >> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
> >>>> >> >> Sent: Thursday, April 21, 2011 5:37 AM
> >>>> >> >> To: General Discussion of SQLite Database
> >>>> >> >> Subject: EXT :[sqlite] date field with default current date
> >>>> >> >>
> >>>> >> >> Hi.
> >>>> >> >> I'm working with python and sqlite3 and i ask how to create a
> table
> >>>> with
> >>>> >> a
> >>>> >> >> date
> >>>> >> >> field wih defaults current date.
> >>>> >> >> Thanks.
> >>>> >> >> --
> >>>> >> >> Fabio Spadaro
> >>>> >> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
> >>>> >> >> ___
> >>>> >> >> sqlite-users mailing list
> >>>> >> >> sqlite-users@sqlite.org
> >>>> >> >> http://sqli

Re: [sqlite] date field with default current date

2011-04-22 Thread Pavel Ivanov
> In my system is set up with 11:35:07 while I am in the data 9:37:30
> Why?

http://www.sqlite.org/lang_createtable.html
"If the default value of a column is CURRENT_TIME, CURRENT_DATE or
CURRENT_TIMESTAMP, then the value used in the new row is a text
representation of the current UTC date and/or time."

It won't be your local time.


Pavel


On Fri, Apr 22, 2011 at 5:46 AM, Fabio Spadaro  wrote:
> Hi.
>
> 2011/4/22 Fabio Spadaro 
>
>> Hi
>>
>>
>> 2011/4/22 Fabio Spadaro 
>>
>>> Hi.
>>>
>>>
>>> 2011/4/22 Pavel Ivanov 
>>>
>>>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>>>> >> module?
>>>> > [(u'3.5.9',)]
>>>>
>>>> Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
>>>> show us an exact statement you are trying to execute and the exact
>>>> text of error you get?
>>>>
>>>>
>>>> Pavel
>>>>
>>>>
>>>> On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro 
>>>> wrote:
>>>> > Hi.
>>>> >
>>>> > 2011/4/21 Pavel Ivanov 
>>>> >
>>>> >> > Does not work on python with sqlite3 module
>>>> >>
>>>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>>>> >> module?
>>>> >>
>>>> >>
>>>> >> Pavel
>>>> >>
>>>> >>
>>>> >> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro <
>>>> fabiolinos...@gmail.com>
>>>> >> wrote:
>>>> >> > Hi.
>>>> >> >
>>>> >> > 2011/4/21 Black, Michael (IS) 
>>>> >> >
>>>> >> >> create table t (d default CURRENT_DATE,i number);
>>>> >> >> insert into t (i) values(1);
>>>> >> >> select * from t;
>>>> >> >> 2011-04-21|1
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> Use CURRENT_TIME if you want hours/minutes too.
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> Michael D. Black
>>>> >> >>
>>>> >> >> Senior Scientist
>>>> >> >>
>>>> >> >> NG Information Systems
>>>> >> >>
>>>> >> >> Advanced Analytics Directorate
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> 
>>>> >> >> From: sqlite-users-boun...@sqlite.org [
>>>> sqlite-users-boun...@sqlite.org]
>>>> >> on
>>>> >> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
>>>> >> >> Sent: Thursday, April 21, 2011 5:37 AM
>>>> >> >> To: General Discussion of SQLite Database
>>>> >> >> Subject: EXT :[sqlite] date field with default current date
>>>> >> >>
>>>> >> >> Hi.
>>>> >> >> I'm working with python and sqlite3 and i ask how to create a table
>>>> with
>>>> >> a
>>>> >> >> date
>>>> >> >> field wih defaults current date.
>>>> >> >> Thanks.
>>>> >> >> --
>>>> >> >> Fabio Spadaro
>>>> >> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
>>>> >> >> ___
>>>> >> >> sqlite-users mailing list
>>>> >> >> sqlite-users@sqlite.org
>>>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>> >> >> ___
>>>> >> >> sqlite-users mailing list
>>>> >> >> sqlite-users@sqlite.org
>>>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>> >> >>
>>>> >> >
>>>> >> > Does not work on python with sqlite3 module
>>>> >> >
>>>> >> > --
>>>> >> > Fabio Spadaro
>>>

Re: [sqlite] date field with default current date

2011-04-22 Thread Marian Cascaval






From: Fabio Spadaro 
To: General Discussion of SQLite Database 
Sent: Fri, April 22, 2011 12:46:53 PM
Subject: Re: [sqlite] date field with default current date


>In my system is set up with 11:35:07 while I am in the data 9:37:30
>Why?

What is the difference between your system time and UTC?




Marian Cascaval
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-22 Thread Fabio Spadaro
Hi.

2011/4/22 Fabio Spadaro 

> Hi
>
>
> 2011/4/22 Fabio Spadaro 
>
>> Hi.
>>
>>
>> 2011/4/22 Pavel Ivanov 
>>
>>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>>> >> module?
>>> > [(u'3.5.9',)]
>>>
>>> Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
>>> show us an exact statement you are trying to execute and the exact
>>> text of error you get?
>>>
>>>
>>> Pavel
>>>
>>>
>>> On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro 
>>> wrote:
>>> > Hi.
>>> >
>>> > 2011/4/21 Pavel Ivanov 
>>> >
>>> >> > Does not work on python with sqlite3 module
>>> >>
>>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>>> >> module?
>>> >>
>>> >>
>>> >> Pavel
>>> >>
>>> >>
>>> >> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro <
>>> fabiolinos...@gmail.com>
>>> >> wrote:
>>> >> > Hi.
>>> >> >
>>> >> > 2011/4/21 Black, Michael (IS) 
>>> >> >
>>> >> >> create table t (d default CURRENT_DATE,i number);
>>> >> >> insert into t (i) values(1);
>>> >> >> select * from t;
>>> >> >> 2011-04-21|1
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> Use CURRENT_TIME if you want hours/minutes too.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> Michael D. Black
>>> >> >>
>>> >> >> Senior Scientist
>>> >> >>
>>> >> >> NG Information Systems
>>> >> >>
>>> >> >> Advanced Analytics Directorate
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> 
>>> >> >> From: sqlite-users-boun...@sqlite.org [
>>> sqlite-users-boun...@sqlite.org]
>>> >> on
>>> >> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
>>> >> >> Sent: Thursday, April 21, 2011 5:37 AM
>>> >> >> To: General Discussion of SQLite Database
>>> >> >> Subject: EXT :[sqlite] date field with default current date
>>> >> >>
>>> >> >> Hi.
>>> >> >> I'm working with python and sqlite3 and i ask how to create a table
>>> with
>>> >> a
>>> >> >> date
>>> >> >> field wih defaults current date.
>>> >> >> Thanks.
>>> >> >> --
>>> >> >> Fabio Spadaro
>>> >> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
>>> >> >> ___
>>> >> >> sqlite-users mailing list
>>> >> >> sqlite-users@sqlite.org
>>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >> >> ___
>>> >> >> sqlite-users mailing list
>>> >> >> sqlite-users@sqlite.org
>>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >> >>
>>> >> >
>>> >> > Does not work on python with sqlite3 module
>>> >> >
>>> >> > --
>>> >> > Fabio Spadaro
>>> >> > www.fabiospadaro.com
>>> >> > ___
>>> >> > sqlite-users mailing list
>>> >> > sqlite-users@sqlite.org
>>> >> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >> >
>>> >> 
>>> >> sqlite-users mailing list
>>> >> sqlite-users@sqlite.org
>>> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >>
>>> >
>>> > [(u'3.5.9',)]
>>> >
>>> >
>>> > --
>>> > Fabio Spadaro
>>> > www.fabiospadaro.com
>>> > ___
>>> > sqlite-users mailing list
>>> > sqlite-users@sqlite.org
>>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>> >
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>
>> from sqlite3 import *
>>   ...
>>   a = gestdb.cur.execute('''create table tipo (d date default
>> CURRENT_DATE''')
>> >>>
>> warning near "CURRENT_DATE": syntax error
>> --
>> Fabio Spadaro
>> www.fabiospadaro.com
>>
>
> Sorry.
> I messed up the placement of quote.
> Work.
>
> --
> Fabio Spadaro
> www.fabiospadaro.com
>


I just set a table with "create table timest (test text, d timestamp
default CURRENT_TIMESTAMP) "
After i just make insert: "insert into timest (test) values ​​('2') "
I see these values: '(u'2', datetime.datetime (2011,4, 22, 9, 37, 30) '
but the clock set up in my MS windows OS is set to different time.
In my system is set up with 11:35:07 while I am in the data 9:37:30
Why?
Thanks.
-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-22 Thread Fabio Spadaro
Hi

2011/4/22 Fabio Spadaro 

> Hi.
>
>
> 2011/4/22 Pavel Ivanov 
>
>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>> >> module?
>> > [(u'3.5.9',)]
>>
>> Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
>> show us an exact statement you are trying to execute and the exact
>> text of error you get?
>>
>>
>> Pavel
>>
>>
>> On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro 
>> wrote:
>> > Hi.
>> >
>> > 2011/4/21 Pavel Ivanov 
>> >
>> >> > Does not work on python with sqlite3 module
>> >>
>> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
>> >> module?
>> >>
>> >>
>> >> Pavel
>> >>
>> >>
>> >> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro <
>> fabiolinos...@gmail.com>
>> >> wrote:
>> >> > Hi.
>> >> >
>> >> > 2011/4/21 Black, Michael (IS) 
>> >> >
>> >> >> create table t (d default CURRENT_DATE,i number);
>> >> >> insert into t (i) values(1);
>> >> >> select * from t;
>> >> >> 2011-04-21|1
>> >> >>
>> >> >>
>> >> >>
>> >> >> Use CURRENT_TIME if you want hours/minutes too.
>> >> >>
>> >> >>
>> >> >>
>> >> >> Michael D. Black
>> >> >>
>> >> >> Senior Scientist
>> >> >>
>> >> >> NG Information Systems
>> >> >>
>> >> >> Advanced Analytics Directorate
>> >> >>
>> >> >>
>> >> >>
>> >> >> 
>> >> >> From: sqlite-users-boun...@sqlite.org [
>> sqlite-users-boun...@sqlite.org]
>> >> on
>> >> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
>> >> >> Sent: Thursday, April 21, 2011 5:37 AM
>> >> >> To: General Discussion of SQLite Database
>> >> >> Subject: EXT :[sqlite] date field with default current date
>> >> >>
>> >> >> Hi.
>> >> >> I'm working with python and sqlite3 and i ask how to create a table
>> with
>> >> a
>> >> >> date
>> >> >> field wih defaults current date.
>> >> >> Thanks.
>> >> >> --
>> >> >> Fabio Spadaro
>> >> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
>> >> >> ___
>> >> >> sqlite-users mailing list
>> >> >> sqlite-users@sqlite.org
>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >> >> ___
>> >> >> sqlite-users mailing list
>> >> >> sqlite-users@sqlite.org
>> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >> >>
>> >> >
>> >> > Does not work on python with sqlite3 module
>> >> >
>> >> > --
>> >> > Fabio Spadaro
>> >> > www.fabiospadaro.com
>> >> > ___
>> >> > sqlite-users mailing list
>> >> > sqlite-users@sqlite.org
>> >> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >> >
>> >> 
>> >> sqlite-users mailing list
>> >> sqlite-users@sqlite.org
>> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >>
>> >
>> > [(u'3.5.9',)]
>> >
>> >
>> > --
>> > Fabio Spadaro
>> > www.fabiospadaro.com
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> from sqlite3 import *
>   ...
>   a = gestdb.cur.execute('''create table tipo (d date default
> CURRENT_DATE''')
> >>>
> warning near "CURRENT_DATE": syntax error
> --
> Fabio Spadaro
> www.fabiospadaro.com
>

Sorry.
I messed up the placement of quote.
Work.

-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-22 Thread Fabio Spadaro
Hi.

2011/4/22 Pavel Ivanov 

> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
> >> module?
> > [(u'3.5.9',)]
>
> Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
> show us an exact statement you are trying to execute and the exact
> text of error you get?
>
>
> Pavel
>
>
> On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro 
> wrote:
> > Hi.
> >
> > 2011/4/21 Pavel Ivanov 
> >
> >> > Does not work on python with sqlite3 module
> >>
> >> What does "SELECT sqlite_version()" gives you in python with sqlite3
> >> module?
> >>
> >>
> >> Pavel
> >>
> >>
> >> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro  >
> >> wrote:
> >> > Hi.
> >> >
> >> > 2011/4/21 Black, Michael (IS) 
> >> >
> >> >> create table t (d default CURRENT_DATE,i number);
> >> >> insert into t (i) values(1);
> >> >> select * from t;
> >> >> 2011-04-21|1
> >> >>
> >> >>
> >> >>
> >> >> Use CURRENT_TIME if you want hours/minutes too.
> >> >>
> >> >>
> >> >>
> >> >> Michael D. Black
> >> >>
> >> >> Senior Scientist
> >> >>
> >> >> NG Information Systems
> >> >>
> >> >> Advanced Analytics Directorate
> >> >>
> >> >>
> >> >>
> >> >> 
> >> >> From: sqlite-users-boun...@sqlite.org [
> sqlite-users-boun...@sqlite.org]
> >> on
> >> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
> >> >> Sent: Thursday, April 21, 2011 5:37 AM
> >> >> To: General Discussion of SQLite Database
> >> >> Subject: EXT :[sqlite] date field with default current date
> >> >>
> >> >> Hi.
> >> >> I'm working with python and sqlite3 and i ask how to create a table
> with
> >> a
> >> >> date
> >> >> field wih defaults current date.
> >> >> Thanks.
> >> >> --
> >> >> Fabio Spadaro
> >> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
> >> >> ___
> >> >> sqlite-users mailing list
> >> >> sqlite-users@sqlite.org
> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> >> ___
> >> >> sqlite-users mailing list
> >> >> sqlite-users@sqlite.org
> >> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> >>
> >> >
> >> > Does not work on python with sqlite3 module
> >> >
> >> > --
> >> > Fabio Spadaro
> >> > www.fabiospadaro.com
> >> > ___
> >> > sqlite-users mailing list
> >> > sqlite-users@sqlite.org
> >> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> >
> >> 
> >> sqlite-users mailing list
> >> sqlite-users@sqlite.org
> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >
> > [(u'3.5.9',)]
> >
> >
> > --
> > Fabio Spadaro
> > www.fabiospadaro.com
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

from sqlite3 import *
  ...
  a = gestdb.cur.execute('''create table tipo (d date default
CURRENT_DATE''')
>>>
warning near "CURRENT_DATE": syntax error
-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Pavel Ivanov
>> What does "SELECT sqlite_version()" gives you in python with sqlite3
>> module?
> [(u'3.5.9',)]

Well, CURRENT_DATE should work then, it was added in 3.1.0. Could you
show us an exact statement you are trying to execute and the exact
text of error you get?


Pavel


On Thu, Apr 21, 2011 at 1:43 PM, Fabio Spadaro  wrote:
> Hi.
>
> 2011/4/21 Pavel Ivanov 
>
>> > Does not work on python with sqlite3 module
>>
>> What does "SELECT sqlite_version()" gives you in python with sqlite3
>> module?
>>
>>
>> Pavel
>>
>>
>> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro 
>> wrote:
>> > Hi.
>> >
>> > 2011/4/21 Black, Michael (IS) 
>> >
>> >> create table t (d default CURRENT_DATE,i number);
>> >> insert into t (i) values(1);
>> >> select * from t;
>> >> 2011-04-21|1
>> >>
>> >>
>> >>
>> >> Use CURRENT_TIME if you want hours/minutes too.
>> >>
>> >>
>> >>
>> >> Michael D. Black
>> >>
>> >> Senior Scientist
>> >>
>> >> NG Information Systems
>> >>
>> >> Advanced Analytics Directorate
>> >>
>> >>
>> >>
>> >> 
>> >> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org]
>> on
>> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
>> >> Sent: Thursday, April 21, 2011 5:37 AM
>> >> To: General Discussion of SQLite Database
>> >> Subject: EXT :[sqlite] date field with default current date
>> >>
>> >> Hi.
>> >> I'm working with python and sqlite3 and i ask how to create a table with
>> a
>> >> date
>> >> field wih defaults current date.
>> >> Thanks.
>> >> --
>> >> Fabio Spadaro
>> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
>> >> ___
>> >> sqlite-users mailing list
>> >> sqlite-users@sqlite.org
>> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >> ___
>> >> sqlite-users mailing list
>> >> sqlite-users@sqlite.org
>> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >>
>> >
>> > Does not work on python with sqlite3 module
>> >
>> > --
>> > Fabio Spadaro
>> > www.fabiospadaro.com
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >
>> 
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> [(u'3.5.9',)]
>
>
> --
> Fabio Spadaro
> www.fabiospadaro.com
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Fabio Spadaro
Hi.

2011/4/21 Pavel Ivanov 

> > Does not work on python with sqlite3 module
>
> What does "SELECT sqlite_version()" gives you in python with sqlite3
> module?
>
>
> Pavel
>
>
> On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro 
> wrote:
> > Hi.
> >
> > 2011/4/21 Black, Michael (IS) 
> >
> >> create table t (d default CURRENT_DATE,i number);
> >> insert into t (i) values(1);
> >> select * from t;
> >> 2011-04-21|1
> >>
> >>
> >>
> >> Use CURRENT_TIME if you want hours/minutes too.
> >>
> >>
> >>
> >> Michael D. Black
> >>
> >> Senior Scientist
> >>
> >> NG Information Systems
> >>
> >> Advanced Analytics Directorate
> >>
> >>
> >>
> >> ________
> >> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org]
> on
> >> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
> >> Sent: Thursday, April 21, 2011 5:37 AM
> >> To: General Discussion of SQLite Database
> >> Subject: EXT :[sqlite] date field with default current date
> >>
> >> Hi.
> >> I'm working with python and sqlite3 and i ask how to create a table with
> a
> >> date
> >> field wih defaults current date.
> >> Thanks.
> >> --
> >> Fabio Spadaro
> >> www.fabiospadaro.com<http://www.fabiospadaro.com/>
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@sqlite.org
> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@sqlite.org
> >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >
> > Does not work on python with sqlite3 module
> >
> > --
> > Fabio Spadaro
> > www.fabiospadaro.com
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> 
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

[(u'3.5.9',)]


-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Pavel Ivanov
> Does not work on python with sqlite3 module

What does "SELECT sqlite_version()" gives you in python with sqlite3 module?


Pavel


On Thu, Apr 21, 2011 at 9:17 AM, Fabio Spadaro  wrote:
> Hi.
>
> 2011/4/21 Black, Michael (IS) 
>
>> create table t (d default CURRENT_DATE,i number);
>> insert into t (i) values(1);
>> select * from t;
>> 2011-04-21|1
>>
>>
>>
>> Use CURRENT_TIME if you want hours/minutes too.
>>
>>
>>
>> Michael D. Black
>>
>> Senior Scientist
>>
>> NG Information Systems
>>
>> Advanced Analytics Directorate
>>
>>
>>
>> 
>> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
>> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
>> Sent: Thursday, April 21, 2011 5:37 AM
>> To: General Discussion of SQLite Database
>> Subject: EXT :[sqlite] date field with default current date
>>
>> Hi.
>> I'm working with python and sqlite3 and i ask how to create a table with a
>> date
>> field wih defaults current date.
>> Thanks.
>> --
>> Fabio Spadaro
>> www.fabiospadaro.com<http://www.fabiospadaro.com/>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> Does not work on python with sqlite3 module
>
> --
> Fabio Spadaro
> www.fabiospadaro.com
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Fabio Spadaro
2011/4/21 Mihai Militaru 

> On Thu, 21 Apr 2011 15:17:00 +0200
> Fabio Spadaro  wrote:
>
> > Does not work on python with sqlite3 module
>
> Try using the date and time functions, 'date' or 'datetime' in your case:
> INSERT INTO table(..., date) VALUES(..., datetime('now'));
>
> http://www.sqlite.org/lang_datefunc.html
>
> --
> Mihai Militaru 
>  ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


Is 'create table ...' does not work ! :)

-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Mihai Militaru
On Thu, 21 Apr 2011 15:17:00 +0200
Fabio Spadaro  wrote:

> Does not work on python with sqlite3 module

Try using the date and time functions, 'date' or 'datetime' in your case:
INSERT INTO table(..., date) VALUES(..., datetime('now'));

http://www.sqlite.org/lang_datefunc.html

-- 
Mihai Militaru 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Fabio Spadaro
Hi.

2011/4/21 Black, Michael (IS) 

> create table t (d default CURRENT_DATE,i number);
> insert into t (i) values(1);
> select * from t;
> 2011-04-21|1
>
>
>
> Use CURRENT_TIME if you want hours/minutes too.
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> NG Information Systems
>
> Advanced Analytics Directorate
>
>
>
> 
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
> behalf of Fabio Spadaro [fabiolinos...@gmail.com]
> Sent: Thursday, April 21, 2011 5:37 AM
> To: General Discussion of SQLite Database
> Subject: EXT :[sqlite] date field with default current date
>
> Hi.
> I'm working with python and sqlite3 and i ask how to create a table with a
> date
> field wih defaults current date.
> Thanks.
> --
> Fabio Spadaro
> www.fabiospadaro.com<http://www.fabiospadaro.com/>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

Does not work on python with sqlite3 module

-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] date field with default current date

2011-04-21 Thread Black, Michael (IS)
create table t (d default CURRENT_DATE,i number);
insert into t (i) values(1);
select * from t;
2011-04-21|1



Use CURRENT_TIME if you want hours/minutes too.



Michael D. Black

Senior Scientist

NG Information Systems

Advanced Analytics Directorate




From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Fabio Spadaro [fabiolinos...@gmail.com]
Sent: Thursday, April 21, 2011 5:37 AM
To: General Discussion of SQLite Database
Subject: EXT :[sqlite] date field with default current date

Hi.
I'm working with python and sqlite3 and i ask how to create a table with a date
field wih defaults current date.
Thanks.
--
Fabio Spadaro
www.fabiospadaro.com<http://www.fabiospadaro.com/>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] date field with default current date

2011-04-21 Thread Fabio Spadaro
Hi.
I'm working with python and sqlite3 and i ask how to create a table with a date
field wih defaults current date.
Thanks.
-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users