Member-only story
Flask, as a microframework, offers the flexibility to choose the data source for applications, as well as extensive library support for interacting with various data sources. It provides libraries for both SQL and NoSQL based databases. Moreover, Flask offers the choice to interact with databases using raw database libraries or via an Object Relational Mapper (ORM) or Object Document Mapper (ODM).
In this article, we will touch upon SQL based databases, explore the use of an ORM layer in a Flask application via Flask-SQLAlchemy.
SQL vs NoSQL
SQL Databases
SQL databases employ Structured Query Language (SQL) for defining and manipulating data, offering versatility and broad acceptance, making it an ideal choice for data storage. These databases excel when dealing with relational data and predefined schemas. However, this rigid schema requirement can be a drawback, as it mandates uniform structure across the entire dataset, which can be challenging in certain situations. SQL databases arrange data in tables consisting of rows and columns and are vertically scalable.