Skip to content

Releases: sqlalchemy/alembic

1.18.4

10 Feb 16:00

Choose a tag to compare

1.18.4

Released: February 10, 2026

bug

  • [bug] [operations] Reverted the behavior of Operations.add_column() that would
    automatically render the "PRIMARY KEY" keyword inline when a
    Column with primary_key=True is added. The automatic
    behavior, added in version 1.18.2, is now opt-in via the new
    Operations.add_column.inline_primary_key parameter. This
    change restores the ability to render a PostgreSQL SERIAL column, which is
    required to be primary_key=True, while not impacting the ability to
    render a separate primary key constraint. This also provides consistency
    with the Operations.add_column.inline_references parameter and
    gives users explicit control over SQL generation.

    To render PRIMARY KEY inline, use the
    Operations.add_column.inline_primary_key parameter set to
    True:

    op.add_column(
    "my_table",
    Column("id", Integer, primary_key=True),
    inline_primary_key=True
    )References: #1232

1.18.3

29 Jan 20:24

Choose a tag to compare

1.18.3

Released: January 29, 2026

bug

  • [bug] [autogenerate] Fixed regression in version 1.18.0 due to #1771 where autogenerate
    would raise NoReferencedTableError when a foreign key constraint
    referenced a table that was not part of the initial table load, including
    tables filtered out by the
    EnvironmentContext.configure.include_name callable or tables
    in remote schemas that were not included in the initial reflection run.

    The change in #1771 was a performance optimization that eliminated
    additional reflection queries for tables that were only referenced by
    foreign keys but not explicitly included in the main reflection run.
    However, this optimization inadvertently removed the creation of
    Table objects for these referenced tables, causing autogenerate
    to fail when processing foreign key constraints that pointed to them.

    The fix creates placeholder Table objects for foreign key targets
    that are not reflected, allowing the autogenerate comparison to proceed
    without error while maintaining the performance improvement from
    #1771. When multiple foreign keys reference different columns in
    the same filtered table, the placeholder table accumulates all necessary
    columns. These placeholder tables may be visible when using the
    EnvironmentContext.configure.include_object callable to
    inspect ForeignKeyConstraint objects; they will have the name,
    schema and basic column information for the relevant columns present.

    References: #1787

  • [bug] [general] Fixed regression caused by #1669 which requires SQLAlchemy objects
    to support generic type subscripting; for the older SQLAlchemy 1.4 series,
    this requires version 1.4.23. Changed the minimum requirements to require
    version 1.4.23 rather than 1.4.0.

    References: #1788

1.18.2

28 Jan 21:23

Choose a tag to compare

1.18.2

Released: January 28, 2026

usecase

  • [usecase] [operations] The primary_key parameter on Column is now honored when
    Operations.add_column() is used, and will emit the "PRIMARY KEY"
    keyword inline within the ADD COLUMN directive. This is strictly a syntax
    enhancement; no attempt is made to reconcile the column's primary key
    status with any existing primary key constraint or particular backend
    limitations on adding columns to the primary key.

    References: #1232

  • [usecase] [operations] Added inline_references parameter to Operations.add_column()
    which allows rendering of REFERENCES clauses inline within the ADD COLUMN directive rather than as a separate ADD CONSTRAINT directive.
    This syntax is supported by PostgreSQL, Oracle, MySQL 5.7+, and MariaDB
    10.5+, and can provide performance benefits on large tables by avoiding
    full table validation when adding a nullable foreign key column.

    References: #1780

bug

  • [bug] [typing] Fixed typing issue where the AlterColumnOp.server_default and
    AlterColumnOp.existing_server_default parameters failed to
    accommodate common SQLAlchemy SQL constructs such as null() and
    text(). Pull request courtesy Sebastian Kreft.

    References: #1669

1.18.1

14 Jan 18:53

Choose a tag to compare

1.18.1

Released: January 14, 2026

bug

  • [bug] [autogenerate] Fixed issue in new plugin system where the configured logger was not
    correctly using the __name__ token to identify the logger.

    References: #1779

  • [bug] [operations] Revised the change regarding SQLAlchemy 2.1 and deprecation warnings
    related to isolate_from_table=True. Further developments in release 2.1
    have revised how this parameter will be modified.

1.18.0

09 Jan 21:22

Choose a tag to compare

1.18.0

Released: January 9, 2026

feature

  • [feature] [operations] When alembic is run in "verbose" mode, alembic now logs a message to
    indicate from which file is used to load the configuration.

    References: #1737

  • [feature] [autogenerate] Autogenerate reflection sweeps now use the "bulk" inspector methods
    introduced in SQLAlchemy 2.0, which for selected dialects including
    PostgreSQL and Oracle use batched queries to reflect whole collections of
    tables using O(1) queries rather than O(N).

    References: #1771

  • [feature] [autogenerate] Release 1.18.0 introduces a plugin system that allows for automatic
    loading of third-party extensions as well as configurable autogenerate
    compare functionality on a per-environment basis.

    The Plugin class provides a common interface for extensions that
    register handlers among Alembic's existing extension points such as
    Operations.register_operation() and
    Operations.implementation_for(). A new interface for registering
    autogenerate comparison handlers,
    Plugin.add_autogenerate_comparator(), provides for autogenerate
    compare functionality that may be custom-configured on a per-environment
    basis using the new
    EnvironmentContext.configure.autogenerate_plugins parameter.

    The change does not impact well known Alembic add-ons such as
    alembic-utils, which continue to work as before; however, such add-ons
    have the option to provide plugin entrypoints going forward.

    As part of this change, Alembic's autogenerate compare functionality is
    reorganized into a series of internal plugins under the
    alembic.autogenerate namespace, which may be individually or
    collectively identified for inclusion and/or exclusion within the
    EnvironmentContext.configure() call using a new parameter
    EnvironmentContext.configure.autogenerate_plugins. This
    parameter is also where third party comparison plugins may also be
    indicated.

    See alembic.plugins.toplevel for complete documentation on
    the new Plugin class as well as autogenerate-specific usage
    instructions.

usecase

  • [usecase] [environment] The file_template configuration option now supports directory paths,
    allowing migration files to be organized into subdirectories. When using
    directory separators in file_template (e.g.,
    %(year)d/%(month).2d/%(day).2d_%(rev)s_%(slug)s), Alembic will
    automatically create the necessary directory structure. The
    recursive_version_locations setting must be set to true when using
    this feature in order for the revision files to be located for subsequent
    commands.

    References: #1774

  • [usecase] Avoid deprecation warning in add/drop constraint added in SQLAlchemy 2.1.
    Ensure that alembic is compatible with the changes added in
    sqlalchemy/sqlalchemy#13006
    by explicitly setting isolate_from_table=True when running with
    SQLAlchemy 2.1 or greater.

bug

  • [bug] [postgresql] Fixed issue where PostgreSQL sequence defaults on non-primary key columns
    were incorrectly detected as changed on every autogenerate run. Server
    default comparison logic is adjusted to filter out the ::regclass
    expression added by the server which interferes with the comparison.

    References: #1507

  • [bug] [mssql] Implemented DDL for column comment add/update/delete when using the
    Operations.alter_column.comment parameter with
    Operations.alter_column() on Microsoft SQL Server. Previously,
    these functions were not implemented for SQL Server and would raise
    UnsupportedCompilationError.

    References: #1755

1.17.2

14 Nov 20:35

Choose a tag to compare

1.17.2

Released: November 14, 2025

feature

  • [feature] [operations] Added Operations.implementation_for.replace parameter to
    Operations.implementation_for(), allowing replacement of existing
    operation implementations. This allows for existing operations such as
    CreateTableOp to be extended directly. Pull request courtesy
    justanothercatgirl.

    References: #1750

bug

  • [bug] [mssql] Fixed issue in SQL Server dialect where the DROP that's automatically
    emitted for existing default constraints during an ALTER COLUMN needs to
    take place before not just the modification of the column's default, but
    also before the column's type is changed.

    References: #1744

1.17.1

29 Oct 00:23

Choose a tag to compare

1.17.1

Released: October 28, 2025

usecase

  • [usecase] [commands] Added command.current.check_heads parameter to
    command.current() command, available from the command line via the
    --check-heads option to alembic current. This tests if all head
    revisions are applied to the database and raises DatabaseNotAtHead
    (or from the command line, exits with a non-zero exit code) if this is not
    the case. The parameter operates equvialently to the cookbook recipe
    cookbook_check_heads. Pull request courtesy Stefan Scherfke.

    References: #1705

bug

  • [bug] [commands] Disallow ':' character in custom revision identifiers. Previously, using a
    colon in a revision ID (e.g., 'REV:1') would create the revision, however
    revisions with colons in them are not correctly interpreted by other
    commands, as it overlaps with the revision range syntax. Pull request
    courtesy Kim Wooseok with original implementation by Hrushikesh Patil.

    References: #1540

1.17.0

11 Oct 18:40

Choose a tag to compare

1.17.0

Released: October 11, 2025

  • [change] [tests] The top-level test runner has been changed to use nox, adding a
    noxfile.py as well as some included modules. The tox.ini file
    remains in place so that tox runs will continue to function in the near
    term, however it will be eventually removed and improvements and
    maintenance going forward will be only towards noxfile.py.

  • [change] [general] The minimum Python version is now 3.10, as Python 3.9 is EOL.

1.16.5

27 Aug 18:02

Choose a tag to compare

1.16.5

Released: August 27, 2025

bug

  • [bug] [mysql] Fixed Python-side autogenerate rendering of index expressions in MySQL
    dialect by aligning it with SQLAlchemy's MySQL index expression rules. Pull
    request courtesy david-fed.

    References: #1492

  • [bug] [config] Fixed issue where new pyproject.toml config would fail to parse the integer
    value used for the truncate_slug_length parameter. Pull request
    courtesy LuΓ­s Henrique Allebrandt Schunemann.

    References: #1709

1.16.4

10 Jul 16:17

Choose a tag to compare

1.16.4

Released: July 10, 2025

bug

  • [bug] [config] Fixed issue in new pyproject.toml support where boolean values, such as
    those used for the recursive_version_locations and sourceless
    configuration parameters, would not be accepted.

    References: #1694