psycopg2: insert multiple rows with one query

后端 未结 15 2619
谎友^
谎友^ 2020-11-22 09:11

I need to insert multiple rows with one query (number of rows is not constant), so I need to execute query like this one:

INSERT INTO t (a, b) VALUES (1, 2),         


        
15条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 09:58

    execute_batch has been added to psycopg2 since this question was posted.

    It is slower than execute_values but simpler to use.

提交回复
热议问题