Python:Peewee 更新查询不工作

Python: Peewee Update Query is not working

我使用 pewee 和以下查询:

 for row in Group.select():
    group_data = process_group(row.link)
    Group.update(name=group_data[0], type=group_data[1], member=group_data[2]).where(Group.id==1)

for row in Group.select():
    group_data = processl_group(row.link)
    Group.update(name=group_data[0], type=group_data[1], member=group_data[2]).where(Group.link==row.link)

组 - 是 table 名称; name,type,member,link - 是列 数据库-sqllite

我单独测试了 group_data 值是否退出并且没问题,现在发布 Group.id= 1 ;存在

我不知道是什么问题。请帮忙

您需要在查询结束时调用 .execute()

for row in Group.select():
    group_data = process_group(row.link)
    (Group
     .update(name=group_data[0], type=group_data[1], member=group_data[2])
     .where(Group.id==1)
     .execute()) # Added .execute