Skip to content

Releases: sqlalchemy/alembic

1.14.0

04 Nov 18:44
Compare
Choose a tag to compare

1.14.0

Released: November 4, 2024

usecase

  • [usecase] [runtime] Added a new hook to the DefaultImpl
    DefaultImpl.version_table_impl(). This allows third party dialects
    to define the exact structure of the alembic_version table, to include use
    cases where the table requires special directives and/or additional columns
    so that it may function correctly on a particular backend. This is not
    intended as a user-expansion hook, only a dialect implementation hook to
    produce a working alembic_version table. Pull request courtesy Maciek
    BryΕ„ski.

    References: #1560

1.13.3

23 Sep 14:52
Compare
Choose a tag to compare

1.13.3

Released: September 23, 2024

usecase

  • [usecase] [autogenerate] Render if_exists and if_not_exists parameters in
    CreateTableOp, CreateIndexOp, DropTableOp and
    DropIndexOp in an autogenerate context. While Alembic does not
    set these parameters during an autogenerate run, they can be enabled using
    a custom Rewriter in the env.py file, where they will now be
    part of the rendered Python code in revision files. Pull request courtesy
    of Louis-Amaury Chaib (@lachaib).

  • [usecase] [environment] Enhance version_locations parsing to handle paths containing newlines.

    References: #1509

  • [usecase] [operations] Added support for Operations.create_table.if_not_exists and
    Operations.drop_table.if_exists, adding similar functionality
    to render IF [NOT] EXISTS for table operations in a similar way as with
    indexes. Pull request courtesy Aaron Griffin.

    References: #1520

misc

  • [change] [general] The pin for setuptools<69.3 in pyproject.toml has been removed.
    This pin was to prevent a sudden change to PEP 625 in setuptools from
    taking place which changes the file name of SQLAlchemy's source
    distribution on pypi to be an all lower case name, and the change was
    extended to all SQLAlchemy projects to prevent any further surprises.
    However, the presence of this pin is now holding back environments that
    otherwise want to use a newer setuptools, so we've decided to move forward
    with this change, with the assumption that build environments will have
    largely accommodated the setuptools change by now.

1.13.2

26 Jun 15:46
Compare
Choose a tag to compare

1.13.2

Released: June 26, 2024

usecase

  • [usecase] [autogenerate] Improve computed column compare function to support multi-line expressions.
    Pull request courtesy of Georg Wicke-Arndt.

    References: #1391

bug

  • [bug] [commands] Fixed bug in alembic command stdout where long messages were not properly
    wrapping at the terminal width. Pull request courtesy Saif Hakim.

    References: #1384

  • [bug] [execution] Fixed internal issue where Alembic would call connection.execute()
    sending an empty tuple to indicate "no params". In SQLAlchemy 2.1 this
    case will be deprecated as "empty sequence" is ambiguous as to its intent.

    References: #1394

  • [bug] [tests] Fixes to support pytest 8.1 for the test suite.

    References: #1435

  • [bug] [autogenerate] [postgresql] Fixed the detection of serial column in autogenerate with tables
    not under default schema on PostgreSQL

    References: #1479

1.13.1

20 Dec 17:06
Compare
Choose a tag to compare

1.13.1

Released: December 20, 2023

bug

  • [bug] [autogenerate] Fixed Rewriter so that more than two instances could be chained
    together correctly, also allowing multiple process_revision_directives
    callables to be chained. Pull request courtesy zrotceh.

    References: #1337

  • [bug] [environment] Fixed issue where the method EnvironmentContext.get_x_argument()
    using the EnvironmentContext.get_x_argument.as_dictionary
    parameter would fail if an argument key were passed on the command line as
    a name alone, that is, without an equal sign = or a value. Behavior is
    repaired where this condition is detected and will return a blank string
    for the given key, consistent with the behavior where the = sign is
    present and no value. Pull request courtesy Iuri de Silvio.

    References: #1369

  • [bug] [autogenerate] Fixed issue where the "unique" flag of an Index would not be maintained
    when generating downgrade migrations. Pull request courtesy Iuri de
    Silvio.

    References: #1370

  • [bug] [versioning] Fixed bug in versioning model where a downgrade across a revision with two
    down revisions with one down revision depending on the other, would produce
    an erroneous state in the alembic_version table, making upgrades impossible
    without manually repairing the table. Thanks much to Saif Hakim for
    the great work on this.

    References: #1373

  • [bug] [typing] Updated pep-484 typing to pass mypy "strict" mode, however including
    per-module qualifications for specific typing elements not yet complete.
    This allows us to catch specific typing issues that have been ongoing
    such as import symbols not properly exported.

    References: #1377

1.13.0

01 Dec 15:25
Compare
Choose a tag to compare

1.13.0

Released: December 1, 2023

changed

  • [changed] [installation] Alembic 1.13 now supports Python 3.8 and above.

    References: #1359

usecase

  • [usecase] [operations] Updated logic introduced in #151 to allow if_exists and
    if_not_exists on index operations also on SQLAlchemy
    1.4 series. Previously this feature was mistakenly requiring
    the 2.0 series.

    References: #1323

  • [usecase] Replaced python-dateutil with the standard library module
    zoneinfo.
    This module was added in Python 3.9, so previous version will been
    to install the backport of it, available by installing the backports.zoneinfo
    library. The alembic[tz] option has been updated accordingly.

    References: #1339

bug

  • [bug] [commands] Fixed issue where the alembic check command did not function correctly
    with upgrade structures that have multiple, top-level elements, as are
    generated from the "multi-env" environment template. Pull request courtesy
    Neil Williams.

    References: #1234

  • [bug] [autogenerate] Fixed autogenerate issue where create_table_comment() and
    drop_table_comment() rendering in a batch table modify would include
    the "table" and "schema" arguments, which are not accepted in batch as
    these are already part of the top level block.

    References: #1361

  • [bug] [postgresql] Additional fixes to PostgreSQL expression index compare feature.
    The compare now correctly accommodates casts and differences in
    spacing.
    Added detection logic for operation clauses inside the expression,
    skipping the compare of these expressions.
    To accommodate these changes the logic for the comparison of the
    indexes and unique constraints was moved to the dialect
    implementation, allowing greater flexibility.

    References: #1321, #1327, #1356

1.12.1

26 Oct 15:10
Compare
Choose a tag to compare

1.12.1

Released: October 26, 2023

usecase

  • [usecase] Alembic now accommodates for Sequence and Identity that support dialect kwargs.
    This is a change that will be added to SQLAlchemy v2.1.

    References: #1304

bug

  • [bug] [autogenerate] [regression] Fixed regression caused by #879 released in 1.7.0 where the
    ".info" dictionary of Table would not render in autogenerate create
    table statements. This can be useful for custom create table DDL rendering
    schemes so it is restored.

    References: #1329

  • [bug] [typing] Improved typing in the
    EnvironmentContext.configure.process_revision_directives
    callable to better indicate that the passed-in type is
    MigrationScript, not the MigrationOperation base class,
    and added typing to the example at cookbook_no_empty_migrations to
    illustrate.

    References: #1325

  • [bug] [operations] Repaired ExecuteSQLOp so that it can participate in "diff"
    operations; while this object is typically not present in a reflected
    operation stream, custom hooks may be adding this construct where it needs
    to have the correct to_diff_tuple() method. Pull request courtesy
    Sebastian Bayer.

    References: #1335

  • [bug] [typing] Improved the op.execute() method to correctly accept the
    Executable type that is the same which is used in SQLAlchemy
    Connection.execute(). Pull request courtesy Mihail Milushev.

    References: #1058, #1277

  • [bug] [typing] Improve typing of the revision parameter in various command functions.

    References: #930

  • [bug] [typing] Properly type the Operations.create_check_constraint.condition
    parameter of Operations.create_check_constraint() to accept boolean
    expressions.

    References: #1266

  • [bug] [postgresql] Fixed autogen render issue where expressions inside of indexes for PG need
    to be double-parenthesized, meaning a single parens must be present within
    the generated text() construct.

    References: #1322

1.12.0

31 Aug 17:27
Compare
Choose a tag to compare

1.12.0

Released: August 31, 2023

feature

  • [feature] [autogenerate] Added new feature to the "code formatter" function which allows standalone
    executable tools to be run against code, without going through the Python
    interpreter. Known as the exec runner, it complements the existing
    console_scripts runner by allowing non-Python tools such as ruff to
    be used. Pull request courtesy Mihail Milushev.

    References: #1275

usecase

  • [usecase] [autogenerate] Change the default value of
    EnvironmentContext.configure.compare_type to True.
    As Alembic's autogenerate for types was dramatically improved in
    version 1.4 released in 2020, the type comparison feature is now much
    more reliable so is now enabled by default.

    References: #1248

bug

  • [bug] [operations] Added support for op.drop_constraint() to support PostrgreSQL
    ExcludeConstraint objects, as well as other constraint-like objects
    that may be present in third party dialects, by resolving the type_
    parameter to be None for this case. Autogenerate has also been
    enhanced to exclude the type_ parameter from rendering within this
    command when type_ is None. Pull request courtesy David Hills.

    References: #1300

  • [bug] [commmands] Fixed issue where the revision_environment directive in alembic.ini
    was ignored by the alembic merge command, leading to issues when other
    configurational elements depend upon env.py being invoked within the
    command.

    References: #1299

  • [bug] [autogenerate] Fixed issue where the ForeignKeyConstraint.match parameter would not be
    rendered in autogenerated migrations. Pull request courtesy Asib
    Kamalsada.

    References: #1302

1.11.3

16 Aug 16:51
Compare
Choose a tag to compare

1.11.3

Released: August 16, 2023

bug

  • [bug] [autogenerate] [postgresql] Improved autogenerate compare of expression based indexes on PostgreSQL
    to produce fewer wrong detections.

    References: #1270

  • [bug] [autogenerate] Fixed issue with NULLS NOT DISTINCT detection in postgresql that
    would keep detecting changes in the index or unique constraint.

    References: #1291

  • [bug] [commands] Added encoding="locale" setting to the use of Python's
    ConfigParser.read(), so that a warning is not generated when using the
    recently added Python feature PYTHONWARNDEFAULTENCODING specified in
    PEP 597. The encoding is passed as the "locale" string under Python
    3.10 and greater, which indicates that the system-level locale should be
    used, as was the case already here. Pull request courtesy Kevin Kirsche.

    References: #1273

1.11.2

04 Aug 13:56
Compare
Choose a tag to compare

1.11.2

Released: August 4, 2023

feature

  • [feature] [operations] Added parameters if_exists and if_not_exists for index operations.
    Pull request courtesy of Max Adrian.

    References: #151

usecase

  • [usecase] [typing] Added typing to the default script mako templates.

    References: #1253

  • [usecase] [autogenerate] Added support in autogenerate for NULLS NOT DISTINCT in
    the PostgreSQL dialect.

    References: #1248

bug

  • [bug] Fixed format string logged when running a post write hook
    Pull request curtesy of Mathieu DΓ©fosse.

    References: #1261

1.11.1

17 May 22:09
Compare
Choose a tag to compare

1.11.1

Released: May 17, 2023

bug

  • [bug] [autogenerate] [regression] As Alembic 1.11.0 is considered a major release (Alembic does not use
    semver, nor does its parent project SQLAlchemy; this has been
    clarified <versioning_scheme> in the documentation), change
    #1130 modified calling signatures for most operations to consider
    all optional keyword parameters to be keyword-only arguments, to match what
    was always documented and generated by autogenerate. However, two of these
    changes were identified as possibly problematic without a more formal
    deprecation warning being emitted which were the table_name parameter
    to Operations.drop_index(), which was generated positionally by
    autogenerate prior to version 0.6.3 released in 2014, and type_ in
    Operations.drop_constraint() and
    BatchOperations.drop_constraint(), which was documented positionally
    in one example in the batch documentation.

    These two signatures have been
    restored to allow those particular parameters to be passed positionally. A
    future change will include formal deprecation paths (with warnings) for
    these arguments where they will again become keyword-only in a future
    "Significant Minor" release.

    References: #1243, #1245

  • [bug] [typing] Fixed typing use of ~sqlalchemy.schema.Column and other
    generic SQLAlchemy classes.

    References: #1246

  • [bug] [regression] [typing] Restored the output type of Config.get_section() to include
    Dict[str, str] as a potential return type, which had been changed to
    immutable Mapping[str, str]. When a section is returned and the default
    is not used, a mutable dictionary is returned.

    References: #1244