python mysql 判断更新成功

直接上代码
class A
#数据库连接部分
 def server_connection(self):

    try:

        self.server_db.ping()

    except:

        self.server_db = pymysql.connect(host=self.server_config['host'],

                                         user=self.server_config['user'],

                                         passwd=self.server_config['passwd'],

                                         db=self.server_config['dbname'],

                                         port=self.server_config['port'],

                                         charset='utf8mb4')

    return self.server_db
#更新数据库部分

def update_book_desc(self, bookid, desc):

    sql = "update book set title=‘adsf’ where id = 1"

    cursor = self.local_connection().cursor()

    cursor.execute(sql)

    self.test_connection().commit()

    if cursor.rowcount > 0:

        print("更新简介成功 图书ID", bookid)

    else:

        print("更新图书简介失败  图书ID", bookid)

    pass