pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that co

2022-07-30,,,,

问题描述:

Django数据管理((python/mysql))-yaml封装初始化数据

python运行mysql_action.py脚本时报错:pymysql.err.ProgrammingError: (1064, "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 'groups) values('1','Sharon','sharon@163.com','http://127.0.0.1:8000/groups/1/')' at line 1")

原因解析:

mysql_action.py脚本中导入的初始化数据datas.yaml文件里的groups与MySQL的关键词冲突,导致执行insert语句报错。

解决方案:

把datas_yaml文件里面的groups字段改成:api_user.groups(即“表名.字段名”)即可解决关键字冲突问题。

本文地址:https://blog.csdn.net/DaisyCold/article/details/108257394

《pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that co.doc》

下载本文的Word格式文档,以方便收藏与打印。