时间:2021-07-01 10:21:17 帮助过:2人阅读
查询:
User.query.filter(User.username == ‘mis1114‘).first()
#查 user = User.query.filter(User.username == ‘sk‘).first() print(user.id,user.password)
修改:
user.password = ‘111111‘
db.session.commit()
#改 user = User.query.filter(User.username == ‘mis1234‘).first() user.password=‘888888‘ user.username=‘sk‘ db.session.commit() print(user.id,user.password)
删除:
db.session.delete(user)
db.session.commit()
#删 user = User.query.filter(User.username==‘sk‘).first() db.session.delete(user) db.session.commit()
通过用户模型,对数据库进行增删改查操作
标签:修改 .com lte 技术 div es2017 http image 查询