Problem with python prepared stmt parameter passing

元气小坏坏 提交于 2019-12-13 08:30:12

问题


File C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mysql\connector\cursor.py, line 1149, in execute elif len(self._prepared[parameters]) != len(params): TypeError: object of type int has no len()


回答1:


The problem is python make error when we pass single parameter we need to put comma(,) at the end of first parameter. like the follwoing

input=(customerId,)
cursor.execute(sql, input)


来源:https://stackoverflow.com/questions/55762444/problem-with-python-prepared-stmt-parameter-passing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!