Moved from using a list to a database in Flask using SQLAlchemy