There is a table creation method

def dbMaker(): conn = sqlite3.connect(sqlite_file) conn.execute('''CREATE TABLE Goods (Gtin INT NOT NULL, Length INT NOT NULL, Width INT NOT NULL, Height INT NOT NULL, Weight INT NOT NULL, Data Text NOT NULL, Multuplicator INT, Gtin2 Text );''') print('Table were created') 

There is also a method to insert

 def insert(lineList): conn = sqlite3.connect(sqlite_file) c = conn.cursor() for item in lineList: c.execute('insert into Goods values (?,?,?,?,?,?,?,?)', item)) 

Served as input list

 ar=[1,2,3,4,5,'6',7,'8'] insert(ar) 

I get the error ValueError: parameters are of unsupported type

In the table and in the list, the types are the same ..

Reported as a duplicate by jfs , zRrr , Nick Volynkin Jun 9 '16 at 6:23 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Maybe because you insert one item at a time and not the entire lineList . that is, c.execute('insert into Goods values (?,?,?,?,?,?,?,?)', item) looks like this for the first in for c.execute('insert into Goods values (?,?,?,?,?,?,?,?)', 1) - Batanichek
  • I'm not good at python but maybe you just need c.execute('insert into Goods values (?,?,?,?,?,?,?,?)', lineList) - Batanichek

1 answer 1

You do not need a loop in the insert function.
Do not breed concretes, connect once.
Here is the corrected function:

 conn = sqlite3.connect(sqlite_file) def insert(conn, lineList): c = conn.cursor() c.execute('insert into Goods values (?,?,?,?,?,?,?,?)', lineList)) conn.commit()