Skip to content Skip to sidebar Skip to footer

How Can I Update Multiple Columns On Multiple Rows In Postgresql Using Psycopg2

I have a somewhat complex sql query that should update multiple columns on multiple rows in a table. Am trying to pass the multiple parameters to the query and also loop though the

Solution 1:

Your data is already in the format as expected by psycopg2.extras.execute_values.

So, do not convert it to another tuple, simply do

execute_values(cursor, query, data)

Post a Comment for "How Can I Update Multiple Columns On Multiple Rows In Postgresql Using Psycopg2"