Is it just me, or is Sqlite3 goofy?

mensanator at aol.com mensanator at aol.com
Tue Sep 5 13:26:47 EDT 2006


Marc 'BlackJack' Rintsch wrote:
> 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

Oh, so it is "This behaviour is by design".

>
> I think your whole experience is based on it.

But shouldn't a significant feature like that be explained
in the Python manuals? Why should I go dig up Sqlite
FAQs to learn what should have been in the manuals?

> Live with it or use a real RDBMS.

I don't mind living with it as long as it's documented.

>
> 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.  ;-)

Did you miss this statement in Section 13.13?

"If switching to a larger database such as PostgreSQL or Oracle
is later necessary, the switch should be relatively easy. "

Obviously, this is a new useage of "relatively easy" with which
I have been previously unaware.

> 
> Ciao,
> 	Marc 'BlackJack' Rintsch




More information about the Python-list mailing list