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.0.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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alembic-autogenerate-enums-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 49a6fe1a9df48120cb2c4c9d2b8037c8e09799dbf684e339ccf7abd1a7efa966
MD5 891fd1bd8f87cf9c67eef744c9ff9d4f
BLAKE2b-256 f3bd60a62eb9f93c7a6673675c59cdd0ee5a5f2fe85ee3837d8ab1916eb718f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alembic_autogenerate_enums-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2c5dfbfca81c8b3d08e7f17f0eabc5b2a9ad05d710f643586a4a05f53f80b5c
MD5 a6c5d2a14b945ce7559cdcac72fe97e9
BLAKE2b-256 24c29110d1491251463d640511da87167e07649d5127a7335d9fb3d5a723535e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page