Skip to content
Advertisement

SQL iterate UPDATE from python list

Do you guys know how to UPDATE a database from a python list without using cur.executemany? Using cur.executemany I have problems in API calls or something. What is another way to solve this below? Thank you!

I know below is crazy ugly, but I did that.

Advertisement

Answer

Not an answer but I don’t want to edit your code as I don’t have Postgres installed yet.

It seems like with the library you use there is no optimization by using executemany(). So can you try the following code, which is just and transalte from what I usually do. I made comments in capitals as a few things do not make necessarly sense (but possible)

using doc link

does this work?

if it doesn’t try this:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement