Answer the question
In order to leave comments, you need to log in
Python, error while working with Sqlite ( Incorrect number of bindings supplied...)?
Good afternoon,
tell me where I made a mistake and what is wrong with my request?
cursor.execute("INSERT INTO table_name (abcd) VALUES(?)", (data))
#!/usr/bin/env python3
import sqlite3
def insert(conn, data):
cursor=conn.cursor()
cursor.execute("INSERT INTO table_name (abcd) VALUES(?)", (data))
conn.commit()
def main():
data = 'input data'
conn = sqlite3.connect("./test.db")
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS table_name (abcd TEXT)")
insert(conn, data)
conn.commit()
conn.close()
if __name__ == "__main__":
main()
Traceback (most recent call last):
File "./test.py", line 27, in
main()
File "./test.py", line 21, in main
insert(conn, data)
File "./test. py", line 6, in insert
cursor.execute("INSERT INTO table_name (abcd) VALUES(?)", (data))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 10 supplied.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question