Python Forum
MySQL Insert Not all parameters were used in the SQL statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySQL Insert Not all parameters were used in the SQL statement
#1
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?
Reply
#2
(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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Ok, I corrected the post and add the error
Reply
#4
https://stackoverflow.com/a/20818201/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql and mysql.connector error lostintime 2 612 Oct-03-2023, 10:25 PM
Last Post: lostintime
  Python Serial: How to read the complete line to insert to MySQL? sylar 1 787 Mar-21-2023, 10:06 PM
Last Post: deanhystad
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,686 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 5,467 Jan-18-2022, 06:25 PM
Last Post: ilknurg
  Mysql. Not all parameters were used in the SQL statement cybertooth 5 18,357 Oct-14-2021, 05:01 AM
Last Post: cybertooth
  Insert into mysql through python LaKhWaN 0 1,922 Aug-26-2020, 04:54 AM
Last Post: LaKhWaN
  How to insert data if not exists in mysql? farah97 0 2,786 Dec-29-2019, 08:32 AM
Last Post: farah97
  Failed to insert record into MySQL table.Python type tuple cannot be converted farah97 3 21,365 Dec-26-2019, 02:01 PM
Last Post: buran
  How to insert record into MySQL using Phython abhay_kala 1 2,233 Dec-06-2019, 04:34 PM
Last Post: abhay_kala
  MySQL executemany - Failed executing the operation; Could not process parameters josh_marchant 1 7,967 May-16-2019, 04:22 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020