增加:
db.session.add(user)
db.session.commit()
查询:
User.query.filter(User.username == 'mis1114').first()

修改:
user.password = '111111'
db.session.commit()

删除:
db.session.delete(user)
db.session.commit()

 1 user = User(username = 'misjiaojiao',password = 'misjiaojiao')
 2 db.session.add(user)
 3 db.session.commit()
 4 #增
 5 
 6 user = User.query.filter(User.username == 'misjiaojiao').first()
 7 db.session.delete(user)
 8 db.session.commit()
 9 #删
10 
11 user = User.query.filter(User.username == 'misjiaojiao').first()
12 user.password='1234657'
13 db.session.commit()
14 #改
15 
16 user = User.query.filter(User.username == 'misjiaojiao').first()
17 print(user.username,user,password)
18 #查

 

posted on 2017-11-15 15:52  016李云基  阅读(143)  评论(0编辑  收藏  举报