I'm using Flask-SQLAlchemy to query from a database of users; however, while
user = models.User.query.filter_by(username="ganye").first()
will return
<User u'ganye'>
doing
user = models.User.query.filter_by(username="GANYE").first()
returns
None
I'm wondering if there's a way to query the database in a case insensitive way, so that the second example will still return
<User u'ganye'>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…