Chapter 3. Data Modeling in Flask
This chapter covers one of the most important parts of any application, that is, the interaction with database systems. This chapter will take us through how Flask can connect to database systems, define models, and query the databases for retrieval and feeding of data.
In this chapter, we will cover the following recipes:
- Creating a SQLAlchemy DB instance
- Creating a basic product model
- Creating a relational category model
- Database migration using Alembic and Flask-Migrate
- Model data indexing with Redis
- Opting the NoSQL way with MongoDB