![]() (Designed by the Author on Plantuml)Īs we can see, Flask API have 5 functions that depend on the Book table. Here is a UML diagram to show the functions used in the API that will depends on the database schema:įlask app invoked functions that depend on the Book table. The Flask API will use these fields as the data model for the CRUD operations. These fields will be stored in the database via the SQLAlchemy ORM. The design of this project is simple: We have a single table called books that stores the books fields: isbn (ISBN number of the book), title, author, and price. The schema is the metadata structure of the database while the tables are the actual data that we want to store. SQLAlchemy is a Python ORM (Object Relational Mapping) library that makes it easy to work with databases.īefore creating the database, we need to define the database schema and the tables. In this tutorial, I’ve used the Flask-SQLAlchemy extension to create a database and a table for storing books. Whenever you want to use something like the ORM (Object Relational Mapping) in your application, you can use extensions that Flask provides. It is a very lightweight framework that is easy to learn and use.īeing lightweight does not mean that Flask is not powerful. This tutorial is based on Flask and Flask-SQLAlchemy extension.įlask is a microframework for building web apps using Python. We will define services to handle the CRUD operations GET, POST, PUT, and DELETE requests for the RESTful bookshop API.īuilding a bookshop app is helpful for learning because it’s a real example, not a toy project. In this tutorial, you will learn how to build a CRUD application in Flask, and the result will be a working backend for a bookshop web application. ![]() It is a very common task in web development and very useful for learning how to build web apps. A CRUD app is a web app that allows you to create, read, update and delete things.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |