python execute many with “on duplicate key update”?

后端 未结 4 1927
臣服心动
臣服心动 2021-01-06 15:28

I am trying to executemany in python with on duplicate key update, with the following script:

# data from a previous query (returns 4 integers in each row)
r         


        
4条回答
  •  无人及你
    2021-01-06 15:32

    It is a bug of mysqldb as ubuntu said, sightly change the sql then it works:

    insert into tb_name(col1, col2) select 1,2 on duplicate key update col1=1
    

提交回复
热议问题