Answer the question
In order to leave comments, you need to log in
Incomprehensible variable passing during sqlite3 execute?
The problem is, I make a query to the database, the table is created, everything is fine.
cu.execute(insert into inc_indexes(number) values ([])', (nums))
cu.executemany('insert into inc_indexes(number) values ([])', (nums))
sqlite3.OperationalError: no such column:
Answer the question
In order to leave comments, you need to log in
there is a guess that it is necessary to transfer either the correct tuple or a list as the second argument.
and guess because the source code with errors. Please provide real source code.
Number is not a keyword in SQLite? The number of fields in brackets must match the number of their values in brackets after values .
db = sqlite3
c = db.connect(database="incidents")
cu = c.cursor()
print (nums)
cu.execute('create table if not exists inc_indexes(id INTEGER PRIMARY KEY AUTOINCREMENT, number TEXT)')
c.commit()
#Fillup table with short information
for i in nums:
cu.execute('insert into inc_indexes(number) values (?)', i )
c.commit()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question