Is it just me, or is Sqlite3 goofy?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Sep 5 01:58:04 EDT 2006


In <1157418942.105174.228650 at p79g2000cwp.googlegroups.com>,
mensanator at aol.com wrote:

> But watch this: being clueless (but not stupid) is a gift I have
> for troubleshooting. I tried (incorrectly) to insert another record:
> 
> cur.execute("insert into book(title, author, published) values ('Dirk
> Gently''s Holistic Detective Agency','Douglas Adams','1987')")
> 
> (u"Dirk Gently's Holistic Detective Agency", u'Douglas Adams', 1987)
> (u"Dirk Gently's Holistic Detective Agency", u'Douglas Adams', u'1987')
> 
> Uhh...how can a database have a different field type for each record?
> 
> Simple, without a cast when the table is created, the field type is
> whatever you insert into it. That's how the default must work,
> each record has a data structure independent of every other record!
> 
> Wow. Just think of the kind of bugs *that* must cause.
> 
> Bugs?

It's not a bug, it's a feature.  And answered as third point in the FAQ:

http://www.sqlite.org/faq.html#q3

I think your whole experience is based on it.  Live with it or use a
real RDBMS.

If you are so fond of static typing, why are you using Python in the first
place?  Just see it as consistency -- dynamically typed language →
dynamically typed DB columns.  ;-)

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list