本文介紹了編程錯誤:(1064 ....)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我認為這對很多人來說似乎是基本的,但是,我很可能被卡住了.
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 ....)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!