1

I am using sqlite3 python modules and th following code returns the error

InterfaceError: Error binding parameter 0 - probably unsupported type

Note I have already tried with normal (non unicode) strings and the result is the same

# get database cursor
cur = dbConnection.cursor()

# create table for prices
cur.execute( """
   create table if not exists
   prices( time text,                     
           mid integer, 
           exid text,
           selid integer,                     
           priceone real,
           sometext text,
           price2 real,
           primary key (time, mid, exid, selid, priceone)
           foreign key (time, mid, exid, selid) references selection(time, mid, exid,selid) )""" )

#insert price
tuple  = (u'20120228153239788135', 104982590, 1, 4764315, 1.99, u'B', 0.07)
cur.execute( "insert into prices values (?,?,?,?,?,?,?)", tuple)
1
  • Your posted code works fine for me. A side note: try to avoid using built-in names as variable names. Commented Feb 28, 2012 at 21:50

1 Answer 1

2

This code works fine for me.

However, have you changed your table schema at all? Because you add the

 create if not exists

it is likely you changed something but the DB (file) wasn't updated since you have this.

Also, you are passing in an int for exid even though the type is text. It will automatically convert it but still shouldn't do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.