skillfed

alembic-postgresql-enum

Alembic autogenerate support for creation, alteration and deletion of enums

alembic-postgresql-enum v1.10.0 2.9M downloads/30d#2,845 on PyPI345
Permissive license MIT Active released

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-enum

uv

uv add alembic-postgresql-enum

poetry

poetry add alembic-postgresql-enum

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

alembic postgresql enum migrationauto-generate enum migrationspostgresql enum schema changesalembic enum autogeneratedatabase enum version controlpostgresql type management alembic
postgresqlschema-migrationorm

More Database packages