Skip to content

transaction-dependent migrations / "pending trigger events" error with Postgresql #201

@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Jack Zhou (@univerio)

It seems by default alembic runs a sequence of migrations in a single transaction. However, this causes problems in e.g. PostgreSQL where certain queries cannot run together in the same transaction and fail with an error like:

#!

sqlalchemy.exc.OperationalError: (OperationalError) cannot ALTER TABLE "some_table" because it has pending trigger events

Because of this, upgrading a database from None to head all at once might fail while upgrading one None to <intermediate_revision> and then from <intermediate_revision> to head would succeed.

It would be helpful to have the option of running each migration in its own transaction (which means alembic would stop at the first failed migration without rolling back all the previous migrations).


Attachments: 201.patch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions