import pymysql
import json
 
output = {}
output['result'] = ''
# 打开数据库连接
try:
    db = pymysql.connect(host=input['host'], user=input['username'], password=input['passwd'], port=int(input['port']))
    # 使用 cursor() 方法创建一个游标对象 cursor
    db.select_db(input['db'])
    cursor = db.cursor()
    # 使用 execute()  方法执行 SQL 查询 
    sql = "insert into wp_tio2index (date,tio2index,changes) values ('2022-09-16 00:00:00','2215','-0.3')"
    cursor.execute(sql)
    # 使用 fetchone() 方法获取单条数据.
    data = cursor.fetchone
    #print(output)
    # 关闭数据库连接
    db.close()
    output['code'] = 0
    output['msg'] = cursor.fetchone()
except Exception as e:
    output['code'] = 1
    output['msg'] = '连接失败:{}'.format(e)
返回结果:

我的 SQL 语法是一个 insert 新增
insert into wp_tio2index (date,tio2index,changes) values ('2022-09-16 00:00:00','2215','-0.3')
但是为什么新增没数据呢???? 求帮助~
