Phase 5 - Databases (Flask-SQLAlchemy)
Most real apps need persistent data.
In Flask, the most common approach is:
- Flask-SQLAlchemy (integration layer)
- SQLAlchemy (ORM)
- Flask-Migrate (migrations via Alembic)
You’ll learn
- What an ORM is and why it matters
- Setting up Flask-SQLAlchemy
- Defining models and data types
- Creating tables with
db.create_all()db.create_all()(dev only) - CRUD operations (create/read/update/delete)
- Relationships (one-to-many, many-to-many)
- Migrations (Flask-Migrate)
- Raw SQL when you need it
Phase checklist
- Introduction to ORMs
- Setting up Flask-SQLAlchemy
- Configuring Database URI
- Creating Database Models
- Primary Keys and Column Types
- Creating the Database (db.create_all)
- CRUD - Create Record
- CRUD - Read Record
- CRUD - Update Record
- CRUD - Delete Record
- One-to-Many Relationships
- Many-to-Many Relationships
- Database Migrations (Flask-Migrate)
- Executing Raw SQL
If this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
