Howdy,

I'm having troubles with psqlite2 and the return types from a query. The problem
is that my data which is numeric, is being returned as a string. I'm aware of 
the
detect_types=sqlite.PARSE_DECLTYPES argument to the connect function. 

Here's my connection code:  
                self.connection = sqlite.connect(self.dbFile,
detect_types=sqlite.PARSE_DECLTYPES)#
                self.connection.text_factory=str
                self.cursor = self.connection.cursor()

Here's my sql (I'm returning risk1, which is numeric):
create table risk(
        quantity varchar(8),
        color varchar(8),
        risk1 real,
        risk2 real,
        primary key (quantity, color)
        );
        
( I have also tried [REAL, float, FLOAT], none work for me)

Here's my query (this will probably be not much use out of context...):
                primaryKeys = self.primaryKeyFields[table]
                primaryKeyList= ' and '.join(['%s = ?'% pKey for pKey in 
primaryKeys])
                query = 'select %s from %s where %s' % (field, table, 
primaryKeyList)
                paramList = [state[primaryKey] for primaryKey in primaryKeys]
                self.cursor.execute(query, paramList)

Any ideas?

TIA,
Danny

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to