При запросе _SQL = ("INSERT INTO log "
"(phrase,letters,ip,browser_string,results) "
"VALUES ('hitch-kiker'), ('aeiou'), ('127.0.0.1'),('Firefox'),('e,i')")
cursor.execute(___SQL)
Traceback (most recent call last):
File "", line 1, in
cursor.execute(___SQL)
File "C:\Users\Артур\AppData\Local\Programs\Python\Python39\lib\site-packages\mysql\connector\cursor.py", line 569, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "C:\Users\Артур\AppData\Local\Programs\Python\Python39\lib\site-packages\mysql\connector\connection.py", line 651, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "C:\Users\Артур\AppData\Local\Programs\Python\Python39\lib\site-packages\mysql\connector\connection.py", line 538, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.DataError: 1136 (21S01): Column count doesn't match value count at row 1
Артур, все правильно, в примере просто используется форматирование строк.
"VALUES (%(emp_no)s, %(salary)s, %(from_date)s, %(to_date)s)"
то же самое что и
"VALUES (%s, %s, %s, %s)" % (emp_no, salary, from_date, to_date)