ProgrammingError: (1064....)
Asked Answered
W

1

0

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

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.

Here is the code...

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")

I also tried...

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

That too gave the same error message.

Wenda answered 30/12, 2014 at 8:34 Comment(1)
Why do you have "," after %s?Conduplicate
C
1

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

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

Remove it.

Conduplicate answered 30/12, 2014 at 9:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.