使用 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/