Python Forum

Full Version: MySQL Insert Not all parameters were used in the SQL statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to insert in mysql, but I received an error

import mysql.connector
cnx = mysql.connector.connect(user='xxx', password='xx',
                              host='127.0.0.1',
                              database='xxx')

insert = cnx.cursor()
insertC001 = """INSERT INTO efd.reg_C001 (ID,ID_PAI,LINHA,HASH,REG,IND_MOV) VALUES (%d,%d,%d,%d,'%s','%s')"""

data = (0, 2, 14, 0, 'C001', '0')
insert.execute(insertC001,data) 
Error:
--------------------------------------------------------------------------- ProgrammingError Traceback (most recent call last) <ipython-input-1-31f7a3e6b94d> in <module>() 9 10 data = (0, 2, 14, 0, 'C001', '0',) ---> 11 insert.execute(insertC001,data) 12 13 cnx.commit() C:\Desenvolvimento\Anaconda3\lib\site-packages\mysql\connector\cursor_cext.py in execute(self, operation, params, multi) 259 if psub.remaining != 0: 260 raise errors.ProgrammingError( --> 261 "Not all parameters were used in the SQL statement") 262 263 try: ProgrammingError: Not all parameters were used in the SQL statement
Whats the problem?
(Nov-14-2018, 07:43 PM)rfgallon Wrote: [ -> ]I'm trying to insert in mysql, but I received an error
what is the error. post the full traceback in error tags
Ok, I corrected the post and add the error