Looking at sqlalchemy, it looks like *exactly* what I'm after, giving me
the direct control I need at the SQL level, but taking away some of the
tedium of repetitive / simple queries. I've just started exploring
against a simple(ish) sqlite database I use with autoload=True and...
there may be an issue with the way in which column types are mapped to
Pythonish types.

The symptom is that my table has a column defined as a BIT, and another
as DECIMAL. Which are not in the pragma_names dict in the sqlite engine
code. OK, so we add those two in. Oh, and DATETIME. So now we add that
one. But there's more... you see, one of the "features" of sqlite is
that it doesn't validate column types. It's perfectly legal to create a
sqlite table like this (dumped from a sqlite3 session):

c:\temp>sqlite3 test.db
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> CREATE TABLE x (a FOO, b BAR, c BAZ);
sqlite> INSERT INTO x (a, b, c) VALUES (1, 2, 3);
sqlite> SELECT * FROM x;
1|2|3
sqlite>

Now most people -- myself included -- tend to use some of the
more-or-less standard data types: INTEGER, DECIMAL, CURRENCY, DATETIME,
etc. etc. It would seem sensible to create some central list of the
union of all those possibilities and provide mappings for all of them
(many of which would map to the same place). But then what do you with
sqlite which considers *anything* valid? My suggestion would be to have
a catch-all mapping to a string datatype.

I'm quite happy to provide a svn patch for the sqlite code, but this
seems to be an issue which might affect the other engines, too.

Tim Golden

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to