What I want to do seems like it should be pretty straightforward but I just can't get past the errors I'm getting. Basically, I create a list, create a database table and then want to insert the elements of the list into the table. Here's what I've got:
F_wheel_data = [1,3,1,3,1,3,1,3,1,3,2,1,3,1,3,1,3,1,3,1,3,4]
curs.execute('CREATE TABLE F_wheel (url_num INTEGER NOT NULL)')
curs.executemany('INSERT INTO F_wheel VALUES (?)', F_wheel_data)
And the error I get is:
curs.executemany('INSERT INTO F_wheel VALUES (?)', F_wheel_data)
ValueError: parameters are of unsupported type
What gives?
Looking at this documenation for executemany()
, you need to pass a list of tuples.
F_wheel_data = [1,3,1,3,1,3,1,3,1,3,2,1,3,1,3,1,3,1,3,1,3,4]
F_wheel_data = [(i,) for i in F_wheel_data]