Skip to main content
Loading page…
Python Mastery
Chapter 30
Lesson 4 of 4
Schema Migrations with Alembic
Contents
Notes
Tutor
Concept
Why Migrations? The Production Problem
Loading activity…
Previous
1 / 10
Continue
Contents
Notes
Discussion
Tutor
26 min
10 activities
0 of 10 done
In this lesson
1
Why Migrations? The Production Problem
2
Alembic Setup: init, env.py, alembic.ini
3
A Real Migration Script
4
Always Review Auto-Generated Migrations
5
Async SQLAlchemy Awareness
6
Async SQLAlchemy: Lazy Loading
7
Alembic Workflow Quiz
8
Adding a NOT NULL Column Safely
9
Correct Alembic Initialization Order
10
SQLite vs PostgreSQL Migration Differences
Objectives
Learner can explain why migrations are necessary and what problems they solve
Learner can initialize Alembic, configure it for SQLAlchemy models, and generate auto-migrations
Learner can run alembic upgrade head and alembic downgrade -1 safely
Learner can review and fix common auto-generate mistakes before applying migrations
Learner can describe the async SQLAlchemy pattern and the differences from sync code
Chapter 30 · Database Mastery with SQLAlchemy
SQLAlchemy Core & the Engine
ORM Models & Sessions
Relationships & Query Performance
Schema Migrations with Alembic
Previous: Relationships & Query Performance
Next: SQL vs NoSQL