我有一个名为test的MySQL存储过程,它接受一个参数。 我可以使用下面的代码执行python2.7x中的存储过程
data='Teststr'
cur = db.cursor()
cur.execute("CALL test('{0}')".format(data))
但当我使用
^{pr2}$我遇到了
OperationalError: (1318, 'Incorrect number of arguments for PROCEDURE MyDb.test; expected 1, got 7')
看起来python将每个字符视为一个参数。我错过了什么?在
您希望
cur.callproc('test', (data,))
传递1个元素的元组例如:
相关问题 更多 >
编程相关推荐