python - 使用 blob 值时 mysql 数据库插入错误

标签 python mysql blob

使用 python adbapi 在 mysql 的表中插入一行

与 insert 类似,id 是 int,value 是 blob

db.runQuery("INSERT INTO t (id, blob_value) VALUES (%(id)s, %(blob_value)s)", \
{
    "id" : id,
    "blob_value" : blob_value
}

Traceback: <class '_mysql_exceptions.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 INSERT INTO t (id, blob_value) VALUES (%(id)s, %(blob_value)s)",

我认为它可能是 blob_value 中的引号字符 - ' ,这就是失败的原因吗?

好吧,原因是表名——“unlock”,这是mysql的一个关键词。

有人可以帮助如何删除名为“unlock”的表吗?

最佳答案

简短回答:

DROP TABLE `UNLOCK`
SELECT * FROM `UNLOCK`

使用强大的`

关于python - 使用 blob 值时 mysql 数据库插入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10480296/

相关文章:

python - PyQt4-QNativeImage : Unable to attach to shared memory segment

php - 如何在 Laravel 5.2 中更新用户表

image - 使用 grails 和 oracle 保存和显示 blob 数据

javascript - 将Blob转换为WAV文件

python - 我的 Pyramid 不喜欢 Pandas

Python 编程 : Global name 'is_within' is not defined. 我正在使用列表过滤器

java - 使用 count() 时命名参数中的 JPA 错误

javascript - 如何使用回调从带有 node.js 和 ejs 的 mysql 中获取数据?

javascript - text() 方法在 Blob 中不可用

python - tox 无法在 D :\python27 path 中检测到 python 解释器