Migrations
Let’s learn to perform migrations in databases.
We'll cover the following
- Alembic
- Perform migrations using Alembic
- Set environment variable requirement
- Configure Alembic
- Autogenerate database versions
- Apply migrations
- Connect to the database
- Check the Alembic version
- Select the room table
- Retrieve data from the room table
- Data insertion and retrieval in the room table
- Test the updated code
We need a way to create tables that correspond to the objects defined in rentomatic/repository/postgres_objects.py
.
Alembic
The best strategy when we use an ORM like SQLAlchemy is to create and run migrations. For this, we can use Alembic.
Get hands-on with 1400+ tech skills courses.