Congratulations on writing your first Flask app with database support!
In this lesson, you have learned how to:
- import Flask-SQLAlchemy and configure your app to support database connections.
- create your first model representing a table schema using Flask-SQLAlchemy ORM by declaring classes that extend
- specify attributes of database entities by using
- set the primary key
- create a one-to-many relationship by using
- specify foreign key columns
- initialize the database according to the declared models by using
- create database entries as instances of the declared Flask-SQLAlchemy classes
We added the
Annotation model to the
app.py file in order to complete our database schema shown in the first exercise of this lesson. Moreover, we demonstrate for you in the browser how to combine the templates and database queries to list all the books we already put in the database for you. In the next lesson, you will learn how to accomplish this yourself! Excited? Let’s go.
Sign up to start coding