alembic-postgresql-enum
Alembic autogenerate support for creation, alteration and deletion of enums
What it is and what it does
This package hooks into Alembic's autogenerate process to detect when enums are created, modified, or removed from your SQLAlchemy models, then generates migration code to keep your PostgreSQL schema in sync. When you import the package in your migrations/env.py file, it registers custom comparators that watch for enum changes. If you add a new enum column to a model, Alembic will generate migration code that creates the enum type in PostgreSQL before creating the column. If you remove an enum column, the migration will drop the unused enum. If enum values change, the migration generates sync operations to update the type definition.
The package automates enum creation, removal, addition and deletion of enum values, reordering of enum values, and deletion of unused enums from schema. Enum value renaming requires manual migration editing.
Use it for:
- Automatically generate migrations when adding a new PostgreSQL enum column to an existing table
- Track and apply enum value additions or deletions across your codebase without manual SQL
- Clean up unused enum types from PostgreSQL when they are removed from your models
- Maintain consistency between SQLAlchemy enum definitions and the PostgreSQL schema during team development
- Avoid manual enum creation and deletion SQL in migration files by letting autogenerate handle it
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extends Alembic to automatically detect and manage PostgreSQL enum types during schema migrations, handling creation, modification, and deletion of enums and their values.
Yes. If you use Alembic with PostgreSQL enums, this package eliminates a significant manual step in migration generation. It has no known vulnerabilities, low install friction, active maintenance, and permissive MIT licensing. The only limitation is that enum value renames require manual migration editing.
Install
alembic-postgresql-enum on PyPI
pip
pip install alembic-postgresql-enumuv
uv add alembic-postgresql-enumpoetry
poetry add alembic-postgresql-enumInstalling alembic-postgresql-enum
Before you install
Low friction install with only 2 runtime dependencies (alembic and sqlalchemy). Repository is active with recent commits and no known vulnerabilities. Supports Python 3.7 through 3.14.
License in practice
MIT license is permissive and places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install alembic-postgresql-enum
# In migrations/env.py, add at the top:
import alembic_postgresql_enum
# Then run:
alembic revision --autogenerate
Requires an existing Alembic project with SQLAlchemy models using postgresql.ENUM columns; PostgreSQL database backend.
Verify before relying
- Whether enum value renaming truly requires manual migration editing or if there are workarounds
- Performance characteristics with large numbers of enums or enum values
- Compatibility with PostgreSQL versions older than the current release cycle
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — alembic, sqlalchemy |
| Maintenance | actively maintained — 172 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,882,201/month — #2,845 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: alembic_postgresql_enum-1.10.0-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
alembic-autogenerate-enumsExtends Alembic's autogenerate to detect and…
permissive · top 15,000 on PyPI
pytest-alembicA pytest plugin that runs built-in and custom…
permissive · top 5,000 on PyPI
alembic_utilsExtends Alembic to autogenerate database…
permissive · top 5,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
migramigra compares PostgreSQL database schemas and…
permissive · top 15,000 on PyPI
django-pg-zero-downtime-migrationsProvides a Django database backend for…
permissive · top 15,000 on PyPI
Flask-AlembicFlask-Alembic integrates Alembic database…
permissive · top 15,000 on PyPI
Flask-MigrateFlask-Migrate handles SQLAlchemy database…
permissive · top 5,000 on PyPI
django-postgres-extraExtends Django's ORM to expose…
permissive · top 15,000 on PyPI
omnibase-compatProvides shared structural types—enums, DTOs,…
unclear · top 15,000 on PyPI