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.

isaackay
  • 1
  • 1
  • 4

1 Answers1

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.

Maroun
  • 94,125
  • 30
  • 188
  • 241