编程错误:(1064 ....)

ProgrammingError: (1064....)(编程错误:(1064 ....))
本文介绍了编程错误:(1064 ....)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我认为这对很多人来说似乎是基本的,但是,我很可能被卡住了.

I think this my seem elementary to a lot of people and it likely is, however, i am stuck.

我正在从雅虎获取一些数据并尝试通过 python 将其插入到 Mysql 中,我在很多场合都这样做过......除了今天早上.

I am taking some data from Yahoo and attempting to insert it into Mysql through python which i have done on many occassions...apart from this morning.

这是代码...

result = ystockquote.get_price_book_ratio('aap')
cursor.execute("""UPDATE uk SET pricebook = %s, WHERE ID = %s""", (result,6))

由于某种原因我收到此错误

I get this error for some reason

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 'WHERE ID = 6' at line 1")

我也试过...

    cursor.execute("""UPDATE uk SET pricebook = %s, WHERE symbol = %s""", (result,'aap'))

这也给出了同样的错误信息.

That too gave the same error message.

推荐答案

您的查询无效,%s 后有多余的,":

Your query is invalid, you have a redundant "," after %s:

cursor.execute("""UPDATE uk SET pricebook = %s, WHERE ID = %s""", (result,6))
                                              ↑

删除它.

这篇关于编程错误:(1064 ....)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Simulating MySQL#39;s ORDER BY FIELD() in Postgresql(在 Postgresql 中模拟 MySQL 的 ORDER BY FIELD())
Using MySQL query to traverse rows to make a recursive tree(使用MySQL查询遍历行制作递归树)
MySQL LOAD DATA INFILE with ON DUPLICATE KEY UPDATE(MySQL LOAD DATA INFILE 和 ON DUPLICATE KEY UPDATE)
Search for quot;whole word matchquot; in MySQL(搜索“全字匹配在 MySQL 中)
add column to mysql table if it does not exist(如果不存在,则将列添加到 mysql 表)
MIN/MAX vs ORDER BY and LIMIT(MIN/MAX 与 ORDER BY 和 LIMIT)