Because I can extrapolate. I *know* before even trying it that
if I export all my data from a sqlite db to a csv file and then try
to import it into Access that there will be problems if the fields
aren't static typed.
GIGO... Don't rely on the DBMS to catch your bad data for you -- fix
it before you put it /into/ SQLite and you won't have any problems
taking it out of SQLite to some other system.
I've not installed/started other DBMS systems with which to test, so
much of this is based upon various documents found online or in my
library:
SQLite: Attempts to convert data into the type class of the
destination field; if the conversion fails it stored the data "as-is"...
No Data Loss
MySQL: Attempts to convert data into the type class of the destination
field; if the conversion fails, numeric fields seem to receive whatever
portion converted before the non-numeric character(s) were reached.
INPUT: ['132', 'A piece of PI', ' "Pythagoras"', ' -245', ' 3.I4']
OUTPUT: (8L, 132L, 'A piece of PI', ' "Pythagoras"', -245L,
Decimal("3.00"))
{That's three point EYE four on input, the 3. converted and was stored.}
Loss of Data
PostgreSQL (per PostgreSQL Essential Reference, 2002 New Riders):
"If an attempt is made to insert the wrong data type into a column,
PostgreSQL will automatically try to convert the data to the correct
data type."
The 2003 book does state that CAST() returns an error if a
conversion fails -- but the example isn't clear enough to indicate if
there might be "partial success" (a non-numeric in the middle of a
sequence of digits). This error may result in an exception in Python,
depending on how the DB-API adapter behaves.
Documentation for Firebird/Interbase and MaxDB is just as vague -- a
complete failure to convert sets an error code; but do the Python
adapters test and raise an exception, or does the application need to
query for the code?
Any takers on modifying my (non-validating) MySQLdb test program for
Firebird/MaxDB/PostgreSQL and seeing what they produce on the sample CSV
data?
That's one of the reasons why I was such a good test engineer.
I could anticipate problems the design engineers didn't think of
and I would deliberately provoke those problems during testing
and crash their hardware/software.
I wasn't very popular.
Even when it is a documented design behavior and for which
operational procedures are available to minimize future impacts?
You have not "provoked" a problem with SQLite. You /have/ brought up
that the USER (application programmer) of SQLite is responsible for
validating that the data they insert IS what they expect to use in the
future.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/