Nov-18-2022, 01:05 PM
(This post was last modified: Nov-18-2022, 01:44 PM by Yoriz.
Edit Reason: Added code tags
)
Good morning,
I'm developing a program that records data coming from JSON in the MySQL database, but it's generating the following error.
I'm developing a program that records data coming from JSON in the MySQL database, but it's generating the following error.
Error:Traceback (most recent call last):
File "c:\Projetos\api\getCliente\getClienteMySQL.py", line 58, in <module>
cursor.executemany(comandoSQL,valoresInserir)
File "C:\Python310\lib\site-packages\mysql\connector\cursor_cext.py", line 375, in executemany
self.execute(operation, params)
File "C:\Python310\lib\site-packages\mysql\connector\cursor_cext.py", line 271, in execute
raise ProgrammingError(
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
[Done] exited with code=1 in 2.222 secondsCode snippet.while cliente['hasNext'] == True:
valoresInserir = []
nPage = nPage + 1
request = requests.get('http://srv009:8080/api/cdp/v1/getCliente?page=' + str(nPage) + '&pageSize=100', auth=('userapi', '1q2w!Q@WAPIpw'))
cliente = request.json()
for clientes in cliente['items']:
valoresInserir.append((clientes['clienteId'], clientes['nomeAbrev'], clientes['nome']))
comandoSQL = f'INSERT INTO cliente (clienteID, nomeAbrev, nome) VALUES (?, UPPER(?), UPPER(?))'
cursor.executemany(comandoSQL,valoresInserir)
conexao.commit()
