Sample sqlalchemy project showing simple usage, schema migration and data migration.
Create virtual environment
python -m venv venv
Activate virtual environment
venv\Scripts\activate (Windows)
source venv/bin/activate (Linux/MacOS)
Install dependencies
pip install -r requirements.txt
python main.py
Update db/models.py to e.g. add new column
Generate a new migration
alembic revision --autogenerate -m "your message"
alembic upgrade head or running main.py will do this automatically if required
alembic downgrade -1
Delete alembic/versions/*
Delete testdb.db
Generate a new migration