I’m trying to use psycopg2 execute_values for faster execute and keep getting errors so i guess i’m not writing the sql statement write.
That’s what i try:
sql = """UPDATE table SET value1 = %s, value2 = %s, value3 = %s, value4 = %s,
value5 = %s, value6 = %s,value7=%s,value8= %s,value9=%s WHERE id = %s"""
parameters = [
value1,
value2,
value3,
value4,
value5,
value6,
value7,
value8,
value9,
id,
]
execute_values(cur,sql,parameters)
i tried using VALUES as well:
sql="""UPDATE table SET (value1,value2,value3,value4,value5,value6,value7,value8,value9) VALUES (%s) WHERE id=%s"""
i’m keep getting : “the query contains more than one ‘%s’ placeholder” or “not all values formatted during string formatting”
How should i write it?