Is it just me, or is Sqlite3 goofy?

Paul Boddie paul at boddie.org.uk
Sat Sep 9 06:53:55 EDT 2006


Kay Schluehr wrote:
>

[Quoting Marc 'BlackJack' Rintsch...]

> > 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.  ;-)
>
> I have to admit I find this bogus too. It has by no means anything to
> do with static typing but letting "errors pass silently" i.e.
> deactivating runtime type checks as well.

If the questioner had been talking about Perl, most respondents would
rightly have said that Perl's silent coercion or conversion of values
is an irritating source of potential errors. Here, the behaviour of
SQLite, whilst not as bad as Perl - values are not converted into
something different which is then erroneous - does contradict the naive
expectations of users who expect the data type declarations to mean
something and for such constraints to be enforced.

Of course, the criticism of the questioner should be more forgiving in
this debate, since I imagine that most people with experience of SQLite
know of its "loose" data typing model, and that many assume that
everyone else is aware of this feature or limitation, even though that
may not be the case. Thus, the priority should be on emphasizing this
in the module documentation (in order to avoid unnecessary confusion),
along with mentioning other possible strategies for emulating other
database system behaviours: "Other Affinity Modes" in the SQLite
documentation [1] may be helpful here, if the future tense can be
replaced with the present tense whilst preserving the factual content
of that section.

Paul

[1] http://www.sqlite.org/datatype3.html




More information about the Python-list mailing list