我试图在选择
后更新一行instance = session.query(Scouts).filter(Scouts.camp == camp, Scouts.user == user,Scouts.gender == gender).first()
instance.number_of_visits += 1
session.commit()
我的童子军课程如下:
class Scouts(Base):
__tablename__ = 'scouts'
camp = Column(String, primary_key=True)
user = Column(Integer)
gender = Column(String)
number_of_visits = Column(Integer)
def __init__(self, camp, user, gender, number_of_visits):
self.camp = camp
self.user = user
self.gender = gender
self.number_of_visits = number_of_visits
但我有错误
UPDATE statement on table 'scouts' expected to update 1 row(s); 1001 were matched
其中instance.number_of_visits等于1,它不是行列表或类似的行。