Reputation: 16535
In psycopg2 why would you ever use execute_batch over execute_values?
I know they're slightly different in what they algorithmically do but it seems
execute_values
as far as I can tell does everything execute_batch
can do but faster.
Upvotes: 4
Views: 3203
Reputation: 44363
I think that execute_values needs to package its parameters up specifically into a VALUES list. This is fine for INSERT, but for UPDATE and DELETE it can be a bit awkward to rewrite them into joins against a VALUES list, rather than just a series of statements.
Upvotes: 3