SQLite date fields

Tim Chase python.list at tim.thechases.com
Fri Nov 26 15:49:33 CET 2010


On 11/26/2010 07:20 AM, Duncan Booth wrote:
> Tim Roberts<timr at probo.com>  wrote:
>> SQLite is essentially typeless.  ALL fields are stored as
>> strings, with no interpretation.  You can store whatever you
>> want in any column.  The column types are basically there to
>> remind YOU how to handle the data.
>>
>
> Not all fields are stored as strings; they may also be stored
> as integer, floating point values or binary data.

Where the test gets funky:

 >>> import sqlite3
 >>> conn = sqlite3.connect(':memory:')
 >>> c = conn.cursor()
 >>> c.execute('''CREATE TABLE t1 (d DATE, t TEXT, i INTEGER)''')
<sqlite3.Cursor object at 0xb75ac980>
 >>> c.execute('''INSERT INTO t1 (d, t, i) VALUES ('foo', 'bar', 
'baz')''')
<sqlite3.Cursor object at 0xb75ac980>
 >>> c.execute('SELECT * FROM t1')
<sqlite3.Cursor object at 0xb75ac980>
 >>> c.fetchall()
[(u'foo', u'bar', u'baz')]


Reminds me a bit of this [1] thread.

-tkc

[1]
http://www.mail-archive.com/python-list@python.org/msg108200.html






More information about the Python-list mailing list