isaackay
isaackay

Reputation: 1

ProgrammingError: (1064....)

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.

Upvotes: 0

Views: 3500

Answers (1)

Maroun
Maroun

Reputation: 95968

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

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

Remove it.

Upvotes: 1

Related Questions