增加:
db.session.add(user)
db.session.commit()
user = User(username = 'mis1114',password = 'hehe111')
db.session.add(user)
db.session.commit()
查询:
User.query.filter(User.username == 'mis1114').first()
user = User.query.filter(User.username == 'mis1114').first()
user.password = 'hehe111'
db.session.commit()
修改:
user.password = '111111'
db.session.commit()
user = User.query.filter(User.username == 'mis1114').first()
user.password = '111111'
db.session.commit()
删除:
db.session.delete(user)
db.session.commit()
user = User.query.filter(User.username == 'mis1114').first()
db.session.delete(user)
db.session.commit()