都可看做是where但用法不一样
filter_by
question = Questions.query.filter_by(id=1).first()
filter
question = Questions.query.filter(Questions.id==1).first()
其实就是=
与==
还有是否带类名的区别
如果要select * from questions where id < 5
这时只能使用filter
questions = Questions.query.filter(Questions.id < 5).all()
多个条件
question = Questions.query.filter_by(name='hello',id=5).first()
# 或者
question = Questions.query.filter(Questions.name=='hello',Questions.id==5).first()