alembic-autogenerate-enums


Namealembic-autogenerate-enums JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryAlembic hook that allows enums values to be upgraded and downgraded in migrations automatically
upload_time2023-07-19 23:08:46
maintainer
docs_urlNone
authorDavid Wilson
requires_python>=3.7,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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](./test-harness).

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "alembic-autogenerate-enums",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "David Wilson",
    "author_email": "dw@botanicus.net",
    "download_url": "https://files.pythonhosted.org/packages/15/33/e395de48fcc4d9ac0b3c0d934d3eb128031da0888d2f32edd6a28d0a4c7c/alembic-autogenerate-enums-0.1.2.tar.gz",
    "platform": null,
    "description": "\n# alembic-autogenerate-enums\n\nThis package implements an Alembic hook that causes ``alembic revision\n--autogenerate`` to output PostgreSQL ``ALTER TYPE .. ADD VALUE`` SQL\nstatements as part of new migrations.\n\n\n## Usage\n\nAdd the line:\n\n    import alembic_autogenerate_enums\n\nTo the top of your ``env.py``.\n\n\n## Notes\n\nSince ``ALTER TYPE .. ADD VALUE`` cannot run transactionally, each\n``op.sync_enum_values()`` call creates its own temporary private DB connection.\nSee https://bitbucket.org/zzzeek/alembic/issues/123/a-way-to-run-non-transactional-ddl\n\n## Tests\n\nWe have incredibly basic tests in a [sample project](./test-harness).\n\n```\nmkvirtualenv alembic-autogenerate\n```\n\nInstall the main autogenerate package and then the test harness:\n\n```\npip install -e .\npip install -e test-harness\n```\n\n```\ncreateuser alembic-autogenerate\ncreatedb -O alembic-autogenerate alembic-autogenerate_db\n```\n\n```\ncd test-harness && pytest\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Alembic hook that allows enums values to be upgraded and downgraded in migrations automatically",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9115b63dac59e3761ca021359141ab0fab50e4cbca3ba6da90a7c7d2847328c",
                "md5": "b6fcea45395ea6486086ce2bd2f87458",
                "sha256": "07b8fa63b2fca107effc61d3dc86d7ff848dd73b0e6cc9c292e904edcaeb8278"
            },
            "downloads": -1,
            "filename": "alembic_autogenerate_enums-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b6fcea45395ea6486086ce2bd2f87458",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 5228,
            "upload_time": "2023-07-19T23:08:47",
            "upload_time_iso_8601": "2023-07-19T23:08:47.183384Z",
            "url": "https://files.pythonhosted.org/packages/e9/11/5b63dac59e3761ca021359141ab0fab50e4cbca3ba6da90a7c7d2847328c/alembic_autogenerate_enums-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1533e395de48fcc4d9ac0b3c0d934d3eb128031da0888d2f32edd6a28d0a4c7c",
                "md5": "a96a4afebfb43951f901c9a86b45d8c9",
                "sha256": "467adc76f1ef32576e514ef55c400c28900547800b676dec349293519751c128"
            },
            "downloads": -1,
            "filename": "alembic-autogenerate-enums-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a96a4afebfb43951f901c9a86b45d8c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 4886,
            "upload_time": "2023-07-19T23:08:46",
            "upload_time_iso_8601": "2023-07-19T23:08:46.382299Z",
            "url": "https://files.pythonhosted.org/packages/15/33/e395de48fcc4d9ac0b3c0d934d3eb128031da0888d2f32edd6a28d0a4c7c/alembic-autogenerate-enums-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-19 23:08:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "alembic-autogenerate-enums"
}
        
Elapsed time: 0.41053s