Flask-SQLAlchemy allows you to filter a query. There are many ways to filter a query โ examples that provide Flask-SQLAlchemy documents:
User.query.filter_by(username='peter')
User.query.filter(User.email.endswith('@example.com'))
I also found this for a one-to-many relationship:
User.query.filter(User.addresses.any(address=address))
Questions:
- Does anyone know which filters are really available for use? I can not find the list of filters in the documentation, which makes it difficult to query the databases.
- In particular, which filter would I use to check if a user's email is contained in a specific set of email addresses?
source
share