I have read a similar issue (AttributeError: 'tuple' object has no attribute 'keys') and Psycopg's official documentation on placeholders for variables, but I am still getting stuck on what seems to be a most simple query. Sorry for asking this , but what's wrong with the various iterations I have tried?
cur.execute('''
UPDATE scrape_log
SET date_added=%s, result_count=%s
WHERE start_date=%s AND end_date=%s
''', date_scraped, result_count, start_date, end_date)
It returned AttributeError: 'tuple' object has no attribute 'keys'
.
I also tried the following, but it returned the same error.
cur.execute('''
UPDATE scrape_log
SET VALUES (%s, %s)
WHERE start_date=(%s) AND end_date=(%s)
''', (date_scraped, result_count), (start_date,), (end_date,))
What did I do wrong?