pymysql.err.ProgrammingError: (1064)(字符串转译问题)
代码:
sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], actor, Creation_time, p_url)
问题是:
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 'tWe','2018/07/09 09:33','https://piao.damai.cn/155901.html')' at line 1")
原因可能是actor值
有引号
解决方式
pymysql.escape_string()
代码:
sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], pymysql.escape_string(actor), Creation_time, p_url)
pymysql.err.ProgrammingError: (1064)(字符串转译问题)的更多相关文章
- pymysql.err.ProgrammingError: 1064 (Python字符串转义问题)
代码: sql = """INSERT INTO video_info(video_id, title) VALUES("%s","%s&q ...
- sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError)
在我学习flask建立网站时间碰到了一个棘手的问题,就是在我进行操作日志的更新时间,发现表格建立有点错误,导致表缺失,从而报了下面的错误 sqlalchemy.exc.ProgrammingError ...
- pymysql.err.InternalError: (1054, "Unknown column 'None' in 'field list'")
错误提示: Traceback (most recent call last): File "D:/projectwc/test/dd.py", line 43, in <m ...
- 解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column 'headline' at row 1")
解决pymysql.err.InternalError: (1366, "Incorrect string value: '\\xF0\\x9F\\x8C\\xB8' for column ...
- 报错pymysql.err.DataError: (1406, "Data too long for column 'gender' at row 1")
在Django默认的admin后台创建超级用户时, 报错pymysql.err.DataError: (1406, "Data too long for column 'gender' at ...
- pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')错误处理
问题描述: 在使用pymysql库时,利用游标执行插入操作,产生错误,会出现pymysql.err.InternalError: (1205, 'Lock wait timeout exceeded; ...
- mysql修改字段长度及pymysql.err.DataError: (1406, "Data too long for column 'name' at row 1")错误
文章链接:修改字段:https://blog.csdn.net/xiejunna/article/details/78580682 错误分析:https://blog.csdn.net/qq_4214 ...
- pymysql.err.InterfaceError: (0, '')解决办法
导致这个错误的原因是通过pymysql连接MySQL,没有关闭连接的操作,所以短时间内不会出问题,长时间保持这个连接会出现连接混乱.虽然看着自己的代码没错,还是会报 pymysql.err.Inter ...
- MySQL数据库报错pymysql.err.InterfaceError: (0, '')
今天入库的时候出现了报错pymysql.err.InterfaceError: (0, ''),经过排查,发现是由于把连接数据库的代码放到了插入函数的外部,导致多线程运行出错 def write_in ...
随机推荐
- [bzoj1592][Usaco09Feb]Making the Grade 路面修整_动态规划
Making the Grade 路面修整 bzoj-1592 题目大意:给你n段路,每段路有一个高度h[i],将h[i]修改成h[i]$\pm\delta$的代价为$\delta$,求将这n段路修成 ...
- 最小堆的两种实现及其STL代码
#include<cstdio> #include<iostream> #include<algorithm> #include<vector> boo ...
- saprk里面的action - aggregate
上一篇讲到了spark里面的action函数: Action列表: reduce collect count first take takeSample takeOrdered saveAsTextF ...
- 最简单的基于FFmpeg的移动端样例:Windows Phone HelloWorld
===================================================== 最简单的基于FFmpeg的移动端样例系列文章列表: 最简单的基于FFmpeg的移动端样例:A ...
- jmeter默认生成测试报告
我的jmeter安装在F:\study\apache-jmeter-3.1\apache-jmeter-3.1下,在bin目录下执行 其中E:\code\jmeterReport\Course-tes ...
- codeforces Looksery Cup 2015 D. Haar Features
The first algorithm for detecting a face on the image working in realtime was developed by Paul Viol ...
- phoenixframe自己主动化測试平台对div弹出框(如弹出的div登陆框)的处理
package org.phoenix.cases; import java.util.LinkedList; import org.phoenix.action.WebElementActionPr ...
- 使用U-Boot的NFS(远程/网络用户空间)
前提条件 假设您的主机PC运行的是Ubuntu 14.04.1 LTS或更高版本,并且与您的开发平台在同一个本地网络上;为了简单起见,我们假设网络上也有DHCP服务器.如果使用Juno,请确保使用的是 ...
- 【BZOJ 1602】 牧场行走
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1602 [算法] 倍增求LCA [代码] #include<bits/stdc+ ...
- DCloud-JS-MUI-JS:utils.js
ylbtech-DCloud-JS:utils.js 1. 导航返回返回顶部 1. var oldBack = mui.back; mui.back = function () { mui.back ...