Python+Mysql error occurs?

When using an INSERT query, you must add some data to a table log
>>> _SQL = """insert into log
... (phrase, letters, ip, browser_string, results)
... values
... ('hitch-hiker', 'aeiou', '127.0.0.1', 'Firfox', "{'e', 'i'})"""
>>> cursor.execute(_SQL)

Error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\mysql\connector\cursor.py", line 569, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\mysql\connector\connection.py", line 590, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\mysql\connector\connection.py", line 478, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server version for
the right syntax to use near 'Firefox', "{'e', 'i'}")' at line 4


In the beginning, we did the following and everything worked.
>>> dbconfig = {'host': '127.0.0.1',
... 'user': 'vsearch',
... 'password': 'vsearchpasswd',
... 'database': 'vsearchlogdb',}
import mysql.connector
>>> conn = mysql.connector.connect(**dbconfig)
>>> cursor = conn.cursor()
>>> _SQL = """show tables"""
>>> cursor.execute(_SQL)
>>> res = cursor.fetchall()
>>> res
[('log')]
>>> _SQL = """describe log"""
>>> cursor.execute(_SQL)
>>> res = cursor.fetchall()
>>> res
[('id', 'int(11)', 'NO', 'PRI', None, 'auto_increment'), ('ts', 'timestamp', 'YE
S', ", 'CURRENT_TIMESTAMP', "), ('phrase', 'varchar(128)', 'NO', ", None, ")
, ('letters', 'varchar(32)', 'NO', ", None, "), ('ip', 'varchar(16)', 'NO', "
, None, "), ('browser_string', 'varchar(256)', 'NO', ", None, "), ('results',
 'varchar(64)', 'NO', ", None, ")]

I can not understand in Chom case? Thanks in advance for any help!!!
April 3rd 20 at 17:47
1 answer
April 3rd 20 at 17:49
You have not the above request is shown. inser and Firfox
But it says - check the syntax for
Firefox', "{'e', 'i'}")

Mauger comma, quotation marks where lost, the shielding of some sort. Insert values in normal, f or format.

Find more questions by tags MySQLPython