FastAPI - using Alembic for database migrations

Опубликовано: 31 Май 2025
на канале: Learnbatta
15,221
112

Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.

Why Alembic?
It's allows developers to manage the database migrations with ease.
We can the changes and revert the changes to/from the database.
Alembic is similar to Active Record Migrations for Ruby on Rails

install "alembic" with pipenv
run the command pipenv install alembic
activate the virtual environment with command pipenv shell
now, run the command alembic init alembic. It will create the configuration files for alembic.

#alembic #sqlalchemy #fastapi #flask