--- id: alembic-utils version: "0.8.8" license: MIT license_treatment: permissive maintenance: aging --- # alembic_utils — A sqlalchemy/alembic extension for migrating procedures and views License: permissive · Maintenance: aging · Downloads: 1.6M/mo ## What it is and what it does Alembic Utils is an extension to Alembic, the standard SQLAlchemy migration tool, that adds autogeneration support for PostgreSQL-specific database objects. While Alembic natively detects changes to SQLAlchemy models and generates migration scripts, it does not handle PostgreSQL functions, views, materialized views, triggers, or policies. This package fills that gap by letting you register these entities in your migration environment and have Alembic automatically detect when they are created, modified, or removed, then populate the upgrade and downgrade sections of your migration scripts. You define PostgreSQL entities using classes like PGFunction, PGView, and PGTrigger, register them with the migration system, and then run `alembic revision --autogenerate` as usual. The tool compares your registered definitions against the database and generates the necessary SQL to bring them into sync. This eliminates manual SQL writing for these common schema changes and keeps your migrations declarative and version-controlled alongside your application code. Use it for: - Autogenerate migrations when adding or updating PostgreSQL stored functions in a SQLAlchemy project. - Track changes to database views and materialized views as part of your standard Alembic workflow. - Manage PostgreSQL row-level security policies alongside table schema migrations. - Detect and migrate trigger definitions without writing raw SQL in migration scripts. - Keep PostgreSQL procedures in sync with application code in a version-controlled migration history. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extends Alembic to autogenerate database migrations for PostgreSQL functions, views, materialized views, triggers, and policies alongside standard SQLAlchemy model changes. Yes, if you use Alembic with PostgreSQL and need to version-control functions, views, triggers, or policies. The low install friction, permissive license, and stable maintenance history make it a safe addition to SQLAlchemy projects. The aging release cycle is not a blocker—the package is feature-complete for its scope and the repository shows recent activity. Install it if PostgreSQL-specific schema objects are part of your migration strategy. ## Install pip install alembic-utils uv add alembic-utils poetry add alembic-utils ## Installing alembic_utils Before you install: Low install friction with a pure-Python wheel. Maintenance status is aging—last release 491 days ago—but the repository remains active with recent commits and no archived status, suggesting the package is stable rather than abandoned. License in practice: MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install alembic_utils # In migrations/env.py: from alembic_utils.pg_function import PGFunction from alembic_utils.replaceable_entity import register_entities to_upper = PGFunction( schema='public', signature='to_upper(some_text text)', definition='RETURNS text as $$ SELECT upper(some_text) $$ language SQL;' ) register_entities([to_upper]) # Then: alembic revision --autogenerate -m 'create to_upper' Requires PostgreSQL database; only works with Alembic and SQLAlchemy projects. Verify before relying: - Whether the 491-day gap since last release indicates active maintenance or dormancy despite recent commits. - Performance characteristics when managing large numbers of PostgreSQL entities in a single migration. - Compatibility with PostgreSQL versions beyond the current stable releases. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 1.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags alembic postgresql autogenerate, database migration functions views, sqlalchemy postgres schema migration, alembic materialized views triggers, postgresql function migration tool, alembic extension postgres entities, database procedure migration, database-migration, postgresql, sqlalchemy [View on SkillFed](https://skillfed.io/packages/alembic-utils) · [View on PyPI](https://pypi.org/project/alembic-utils/)