[Solved] pymysql.err.ProgrammingError: (1064, ‘You have an error in your SQL syntax;
Purpose
Use pymysql to insert data into the MySQL database.
Abnormal information
code
sql_test = '''INSERT INTO "es_site" ("id", "site_name", "site_role", "url", "password", "username") VALUES (1, 'test', 'test', 'https://test.com', 'passwd', 'estest');'''
cur.execute(sql_test)
conn.commit()
cur.close()
conn.close()
Solution
The field name in sql cannot be enclosed in quotation marks. Just remove the quotation marks of the field and table name
Read More:
- [Solved] sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, “You have an error in your SQ
- Bulk Update Error: #Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the m
- [Solved] java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corres
- pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- MySQL Build table error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser
- [Solved Perfectly] MySQL ERROR 1064 (42000): You have an error in your SQL syntax;
- [Solved] pymysql.err.internalError: (1054, “Unknown column ‘LGD_xiaohong’ in ‘field list’”)
- MySQL Change password failure prompt: ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M
- Mysql 8.0.13 Enabling remote access (ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th)
- Error 1064 (42000): you have an error in your SQL syntax
- MYSQL Use cmd to change root password error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual tha
- [Solved] pymysql.err.OperationalError: (1045, “Access denied for user ‘root‘@‘192.168.118.44‘
- [Solved] Pyodbc.ProgrammingError: No results. Previous SQL was not a query.
- The setobject() method reports an error. The parameter index out of range and MySQL syntax error exception report an error
- [Solved] there are special symbols in the initial password for installing MySQL in Hadoop, and an error is reported
- Introduction to Relational Databases in SQL
- [Linux Docker Mirror] MYSQL Run sql Script Error: Failed to open file ‘/home/mydatabase.sql‘, error: 2
- java.sql.SQLException: Disk full (/tmp/#sql_1eaa2_60.MAI); waiting for someone to free some space
- Dbeaver connects hive to solve the problem that hive custom UDF functions cannot be used in SQL queries in dbeaver