skillfed

alembic-autogenerate-enums

Alembic hook that allows enums values to be upgraded and downgraded in migrations automatically

alembic-autogenerate-enums v0.1.2 155.7K downloads/30d#10,804 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

This package hooks into Alembic's autogenerate mechanism to automatically detect when PostgreSQL enum types have new values added to your models, then generates the corresponding ALTER TYPE .. ADD VALUE SQL statements in your migration files. Without this hook, Alembic's default autogenerate ignores enum value changes, requiring manual migration writing.

The package works by registering itself when imported into your env.py file. It handles a PostgreSQL constraint: ALTER TYPE statements cannot run inside transactions, so each enum sync operation opens its own temporary database connection. This is a thin, specialized tool for teams using Alembic with PostgreSQL enums who want migrations to stay in sync with model changes automatically.

Use it for:

  • Automatically generate migrations when adding new values to existing PostgreSQL enum types in your SQLAlchemy models.
  • Avoid manual ALTER TYPE SQL writing by letting Alembic detect enum changes during autogenerate.
  • Ensure enum migrations are tracked in version control alongside other schema changes in a PostgreSQL project.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extends Alembic's autogenerate to detect and emit PostgreSQL enum value changes as ALTER TYPE ADD VALUE statements in migrations.

No, not recommended. The package is abandoned with no updates in over a year and has no documented compatibility with current Alembic or PostgreSQL versions. For active projects, the maintenance risk outweighs the convenience of enum autogeneration. Consider manual enum migrations or evaluating whether a maintained alternative exists before adopting this.

Install

alembic-autogenerate-enums on PyPI

pip

pip install alembic-autogenerate-enums

uv

uv add alembic-autogenerate-enums

poetry

poetry add alembic-autogenerate-enums

Installing alembic-autogenerate-enums

Before you install

Low install friction with no runtime dependencies. However, the package is abandoned—last release was 1122 days ago with no recent maintenance signal, which raises questions about compatibility with current Alembic and PostgreSQL versions.

License in practice

MIT license permits commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.

Quickstart

# In your alembic/env.py, add at the top:
import alembic_autogenerate_enums

# Then run migrations normally:
# alembic revision --autogenerate -m "Add enum values"
# alembic upgrade head

Requires PostgreSQL database and an existing Alembic project; the package assumes you are already using Alembic for schema management.

Verify before relying

  • Compatibility with current Alembic versions and PostgreSQL enum handling behavior
  • Whether the non-transactional connection workaround still aligns with modern Alembic patterns
  • Test coverage and real-world usage reliability given the abandoned maintenance status

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,122 days since the last release
First released
Downloads 155,677/month — #10,804 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: alembic_autogenerate_enums-0.1.2-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

alembic enum migrationpostgresql enum autogeneratealembic alter type add valueenum schema migrationalembic postgres enum changes
alembicpostgresqlschema-migration

More Database packages