欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-22 12:10:02
问题描述: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)...

问题描述:

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