Python refuses to execute an sql query
I want to execute an insert sql query with python language in Pycharm. An error is launched after executing the code below:
import mysql.connector
stock = mysql.connector.connect(
host="localhost",
user="root",
passwd="admin2020",
database="stock"
)
sql = "INSERT INTO produit(code, nom, prix_unitaire, tva, quantite) VALUES(%s,%s,%f,%f,%d)"
valeurs = ("LAM","lampe",0.9,0.19,10)
mycursor = stock.cursor()
mycursor.execute(sql, valeurs)
The error message is:
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
%sis allowed