[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:
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- 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
- Oracle creates a job and executes the stored procedure with parameters regularly
- How to Solve Error: mysqlclient 1.4.0 or newer is required; you have 0.10.0
- The setobject() method reports an error. The parameter index out of range and MySQL syntax error exception report an error
- [Solved] Pyodbc.ProgrammingError: No results. Previous SQL was not a query.
- [Solved] Windows MYSQL Error: django.db.utils.OperationalError: (2026, ‘SSL connection error: unknown error number‘)
- Mybatis Add Datas error: ERROR: Field * doesn‘t have a default value
- Mysql Script Error Code: 1136. Column count doesn’t match value count at row 1
- Mysqldump: Got error: 1045: Access denied for user ‘root‘@‘localhost‘
- How to Solve c3p0 connect mysql8.0 Error
- [Solved] pymysql.err.internalError: (1054, “Unknown column ‘LGD_xiaohong’ in ‘field list’”)
- [Mybatis] How to Solve the problem of Oracle query processing more than 1000 in conditions
- Front end error: exceptionmessage: null [How to Solve]
- Can mybatis prevent SQL injection
- [Solved] ORA-04063: package body “SYS.DBMS_DATAPUMP“ has errors
- [Solved] Error: read ECONNRESET at TCP.onStreamRead Cannot enqueue Query after fatal error
- [Solved] there are special symbols in the initial password for installing MySQL in Hadoop, and an error is reported
- Dbeaver connects hive to solve the problem that hive custom UDF functions cannot be used in SQL queries in dbeaver