MySQLdb引发execute() first
错误。
我该如何解决?
def update_query_extendNum(cls,params):
print params
sqlString = "REPLACE INTO editor_query(id,extend_num) values(%s,%s)"
cursor = connection.cursor()
cursor.executemany(sqlString,params)
querys = cursor.fetchall()
cursor.close()
return querys
错误:
File "C:\Python27\lib\site-packages\django\core\handlers\exception.py", line 39, in inner response = get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\work\test\editor\chat_test_service\editor\api.py", line 162, in updataTask update_query = QueryService.update_query_extendNum([('02f0698462344c9299a93fea2d97b34e',11),('0350d8dcb58e48448f6d9fbabc06a43c',111)])
File "C:\work\test\editor\chat_test_service\editor\service.py", line 58, in update_query_extendNum return dao.QueryDao.update_query_extendNum(params)
File "C:\work\test\editor\chat_test_service\editor\dao.py", line 109, in update_query_extendNum querys = cursor.fetchall()
File "C:\Python27\lib\site-packages\django\db\utils.py", line 101, in inner return func(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 101, in inner return func(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQL`enter code here`db\cursors.py", line 382, in fetchall self._check_executed()
File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 105, in _check_executed self.errorhandler(self, ProgrammingError, "execute() first")
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue ProgrammingError: execute() first