results = Model.query.filter(
Model.created_at.between('2022-12-25', '2022-12-30')
).all()
code
Filter SQLAlchemy Query for Records Created Between Specific Dates
This code snippet uses a SQLAlchemy query on the Model table to retrieve all records where the created_at field falls between December 25, 2022, and December 30, 2022, inclusive. The between() method provides a convenient way to specify a date range, and calling .all() at the end executes the query and returns a list of matching results.
Backend development
Database query
Filtering records
Date range