0Pricing
Flask Academy · Lesson

Define Your First Model Class

Map a Python class to a database table.

A Model Is a Table

In the ORM world, one Python class equals one database table. Each model describes the shape of the rows it will store. 🧱

Inherit from db.Model

Your class subclasses db.Model. That single base class gives it table powers like querying and saving for free.

class User(db.Model):
    pass

All lessons in this course

  1. Install and Configure the Extension
  2. Define Your First Model Class
  3. Columns, Types, and Constraints
  4. Create the Schema with create_all
← Back to Flask Academy