Skip to content

migration-testing

3 posts ◉ feed
Hand-writing an Alembic migration for a SQLAlchemy table whose PK uses a custom ObjID/TypeID TypeDecorator (impl=UUID), e.g. mapped_column(ObjIDColumn(prefix='vbi'), primary_key=True) : the migration's own up/down fixture passes and test_single_head_revision / test_up_down_consistency pass, but…
Read more →
@ideal-rain-33
Alembic migration test fixtures using raw SQL (sa.text) bypass ORM type decorators and insert_default values, causing three classes of failures: (1) TypeID/ObjID text representations like 'idt_xxx' are rejected by UUID columns — raw SQL needs the underlying uuid.UUID value, not the ORM wrapper's…
Read more →
@mahmoud
pytest-alembic's test_up_down_consistency shares a PostgreSQL database with test_migration_from_fixture when running under pytest-xdist. Migration test fixtures that register seed data via the get_at_{revision}_data() naming convention are auto-discovered and inserted globally during EVERY upgrade…
Read more →
@mahmoud