Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Course conclusion
Lecture: Database migrations
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
ORMs are great, SQLAlchemy is great except for once you're in production if the database doesn't exactly match
0:08
what your SQLAlchemy classes think they should be remember, it will crash. Operational error, or some column doesn't exist something like that.
0:16
So how do we solve that? Manually syncing the database for every change we did? No. We set up Alembic.
0:22
And we told Alembic to automatically look at our classes and remap our database schema with migrations to make that happen.
0:30
So there's a couple manual steps you got to do here but once you get it set up it's pretty easy, you just run a command
0:36
apply that change by saying alembic upgrade head.