pymsql excute_many 出现 not all arguments converted with on duplicate key update
来源:互联网 发布:美国 私人飞机 知乎 编辑:程序博客网 时间:2024/05/16 13:59
在使用pymysql的execute_many进行批量数据插入的时候,出现 not all arguments converted with on duplicate key update。
sql = insert into test(a,b)values(%s,%s) on duplicate key update b=%s
params=[(1,2),(3,4),(5,6)]
db.executemany(sql,params)
一开始以为是%s跟参数没有对应上,然后去一个一个对,发现还是报这个错误。然后我尝试插入一条的时候,没有报错。证明不是%s跟参数对应不上的问题。
然后上网查资料。sql改成:
sql = insert into test(a,b)values(%s,%s) on duplicate key update b=values(b)就行了。
第一次知道mysql还有这种写法。
参考:
https://stackoverflow.com/questions/26337065/mysqldb-returns-not-all-arguments-converted-with-on-duplicate-key-update
https://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html
阅读全文
0 0
- pymsql excute_many 出现 not all arguments converted with on duplicate key update
- not all arguments converted during string formatting
- not all arguments converted during string formatting
- ON DUPLICATE KEY UPDATE
- on duplicate key update
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- on duplicate key update
- ON DUPLICATE KEY UPDATE
- on duplicate key update
- ON DUPLICATE KEY UPDATE
- ON DUPLICATE KEY UPDATE
- update on duplicate key update
- ON DUPLICATE KEY UPDATE使用中出现的问题
- Keil中Use MicroLIB的作用
- spring boot使用通用mapper(tk.mapper) ,id自增和回显等问题
- android硬件 NFC开发
- app中蓝牙开启与关闭
- PCSHANGPython3连接MariaDB
- pymsql excute_many 出现 not all arguments converted with on duplicate key update
- visual studio code 简介
- 又瞅了几眼Hibernate,整理下知识点____Hibernate
- python常见错误及基本技巧
- 游戏开发中的人工智能(一):游戏人工智能简介
- Linux系统used内存占用很大,而实际系统中个进程并没有占用这么多内存
- 高速二次线性插值算法
- Markdown入门指南
- ARM编译器的semihosting