在mysql中使用python adbapi在表中插入行
与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中,这是它失败的原因吗?
好吧,原因是表名--“解锁”,这是mysql的一个关键字。
有谁能帮我删除一个名为"unlock“的表吗?
发布于 2012-05-07 20:26:48
简短的回答:
DROP TABLE `UNLOCK`
SELECT * FROM `UNLOCK`使用强大的`
发布于 2012-05-07 20:27:55
只需在表名两边加上反记号:
drop table `unlock`;https://stackoverflow.com/questions/10480296
复制相似问题