Zero-Downtime Upgrades With SQLAlchemy and Alembic

Image by John Reed / Unsplash

This talk was delivered at PyCon Ireland 2022. As the name would suggest, I aimed to describe how to implement a database upgrade pattern using SQLAlchemy + Alembic that would allow you to evolve you database schema without incurring downtime.

Alembic is a database migrations tool written by the author of SQLAlchemy. Alembic is easy to get started with an provides a number of sensible defaults out-of-the-box. However, like SQLAlchemy itself, when you look under the hood you find a seriously capable engine capable of powering all sorts of database schema migrations. It can even auto-generate the migration files themselves!

In this presentation, we seek to explore some of these advanced features by implementing a pattern - the expand-contract pattern - that can allow for near zero-downtime database upgrades.

More information is available on the Python Ireland website.

comments powered by Disqus