Skip to main content

alembic-autogenerate-enums

This package implements an Alembic hook that causes alembic revision --autogenerate to output PostgreSQL ALTER TYPE .. ADD VALUE SQL statements as part of new migrations.

Usage

Add the line:

import alembic_autogenerate_enums

To the top of your env.py.

Notes

Since ALTER TYPE .. ADD VALUE cannot run transactionally, each op.sync_enum_values() call creates its own temporary private DB connection. See https://bitbucket.org/zzzeek/alembic/issues/123/a-way-to-run-non-transactional-ddl

Tests

We have incredibly basic tests in a sample project.

mkvirtualenv alembic-autogenerate

Install the main autogenerate package and then the test harness:

pip install -e .
pip install -e test-harness
createuser alembic-autogenerate
createdb -O alembic-autogenerate alembic-autogenerate_db
cd test-harness && pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alembic-autogenerate-enums-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alembic_autogenerate_enums-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file alembic-autogenerate-enums-0.1.1.tar.gz.

File metadata

  • Download URL: alembic-autogenerate-enums-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.4 Darwin/22.4.0

File hashes

Hashes for alembic-autogenerate-enums-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cafd20643181268b98ea22d76cd159325154191e6de865caa5fe99536401e2e2
MD5 4bb9a9f220b4c999d33758281b8274df
BLAKE2b-256 6d2f502bb869c4d59b4338ed0cee1e3ce5e9aa6999df0af3e00db02f600c3552

See more details on using hashes here.

File details

Details for the file alembic_autogenerate_enums-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for alembic_autogenerate_enums-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39b1b9ef8e2a970d43ce9fd73b6bb28d336fe704d9058f51cc59bd68944313c5
MD5 1d0ba2e3afc4e673e12a7b07a748ae03
BLAKE2b-256 ce602c79834a896a99b9abf7923ed8f9184da43ab8e02ff455c207744197c307

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page