增加:
user =
db.session.add(user)
db.session.commit()
user=User(username='蜡笔小新',password='123456')
db.session.add(user)
db.session.commit()
查询:
User.query.filter(User.username == 'mis1114').first()
user=User.query.filter(User.username=='蜡笔小新').first()
print('修改前;',user.id,user.password)
修改:
user.password = '111111'
db.session.commit()
user=User.query.filter(User.username=='蜡笔小新').first()
print('修改前;',user.id,user.password)
user.password='456789'
db.session.commit()
print('修改后;',user.id,user.password)
删除:
db.session.delete(user)
db.session.commit()
user=User.query.filter(User.username=='蜡笔小新').first()
db.session.delete(user)
db.session.commit()