时间:2021-07-01 10:21:17 帮助过:17人阅读
查询:
User.query.filter(User.username == ‘mis1114‘).first()
查询代码:
user = User.query.filter(User.username == ‘tan1997‘).first() print(user.username,user.password)
修改:
user.password = ‘111111‘
db.session.commit()
修改代码:
user=User.query.filter(User.username == ‘tan1997‘).first() user.password=1234567 db.session.commit()
删除:
db.session.delete(user)
db.session.commit()
删除代码:
user=User.query.filter(User.password == ‘19961021‘).first() db.session.delete(user) db.session.commit()
通过用户模型,对数据库进行增删改查操作
标签:blog == 删除 技术 username 修改 print ssi query