ProgrammingError: (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 ....)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:编程错误:(1064 ....)
- 导入具有可变标题的 Excel 文件 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- SQL 临时表问题 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01