Flask 101: Filtering Searches and Deleting Data

Last time we got our Flask based music database application partially functional. It could now add data to the database, edit said data, and also display everything in the database. But we didn’t cover how to filter the data by using the user’s filter choice (Artist, Album name, or publisher name) and search string. We also didn’t cover how to delete items from the database. That is the two-fold goal of this article.
Filtering Search Results
Filtering search results using SQLAlchemy (via Flask-SQLAlchemy) is actually quite easy. All you need to do is create some very simple query objects. Open up the main.py file that we were editing last time and replace the search_results() function with the following version of the code:

Link: https://dzone.com/articles/flask-101-filtering-searches-and-deleting-data?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev