Skip to content

Releases: sqlalchemy/alembic

1.11.0

15 May 19:46
Compare
Choose a tag to compare

1.11.0

Released: May 15, 2023

usecase

  • [usecase] [commands] Added quiet option to the command line, using the -q/--quiet
    option. This flag will prevent alembic from logging anything
    to stdout.

    References: #1109

  • [usecase] [asyncio] Added AbstractOperations.run_async() to the operation module to
    allow running async functions in the upgrade or downgrade migration
    function when running alembic using an async dialect. This function will
    receive as first argument an
    ~sqlalchemy.ext.asyncio.AsyncConnection sharing the transaction
    used in the migration context.

    References: #1231

bug

  • [bug] [batch] Added placeholder classes for ~.sqla.Computed and
    ~.sqla.Identity when older 1.x SQLAlchemy versions are in use,
    namely prior to SQLAlchemy 1.3.11 when the ~.sqla.Computed
    construct was introduced. Previously these were set to None, however this
    could cause issues with certain codepaths that were using isinstance()
    such as one within "batch mode".

    References: #1237

  • [bug] [batch] Correctly pass previously ignored arguments insert_before and
    insert_after in batch_alter_column

    References: #1221

  • [bug] [postgresql] Fix autogenerate issue with PostgreSQL ExcludeConstraint
    that included sqlalchemy functions. The function text was previously
    rendered as a plain string without surrounding with text().

    References: #1230

  • [bug] [mysql] [regression] Fixed regression caused by #1166 released in version 1.10.0 which
    caused MySQL unique constraints with multiple columns to not compare
    correctly within autogenerate, due to different sorting rules on unique
    constraints vs. indexes, which in MySQL are shared constructs.

    References: #1240

  • [bug] [typing] Updated stub generator script to also add stubs method definitions for the
    Operations class and the BatchOperations class obtained
    from Operations.batch_alter_table(). As part of this change, the
    class hierarchy of Operations and BatchOperations has
    been rearranged on top of a common base class AbstractOperations
    in order to type correctly, as BatchOperations uses different
    method signatures for operations than Operations.

    References: #1093

  • [bug] [typing] Repaired the return signatures for Operations that mostly
    return None, and were erroneously referring to Optional[Table]
    in many cases.

  • [bug] [autogenerate] Modified the autogenerate implementation for comparing "server default"
    values from user-defined metadata to not apply any quoting to the value
    before comparing it to the server-reported default, except for within
    dialect-specific routines as needed. This change will affect the format of
    the server default as passed to the
    EnvironmentContext.configure.compare_server_default hook, as
    well as for third party dialects that implement a custom
    compare_server_default hook in their alembic impl, to be passed "as is"
    and not including additional quoting. Custom implementations which rely
    on this quoting should adjust their approach based on observed formatting.

    References: #1178

  • [bug] [api] [autogenerate] Fixed issue where autogenerate.render_python_code() function did not
    provide a default value for the user_module_prefix variable, leading to
    NoneType errors when autogenerate structures included user-defined
    types. Added new parameter
    autogenerate.render_python_code.user_module_prefix to allow
    this to be set as well as to default to None. Pull request courtesy
    tangkikodo.

    References: #1235

misc

  • [change] [py3k] Argument signatures of Alembic operations now enforce keyword-only
    arguments as passed as keyword and not positionally, such as
    Operations.create_table.schema,
    Operations.add_column.type_, etc.

    References: #1130

  • [misc] Update code snippets within docstrings to use black code formatting.
    Pull request courtesy of James Addison.

    References: #1220

1.10.4

24 Apr 15:12
Compare
Choose a tag to compare

1.10.4

Released: April 24, 2023

bug

  • [bug] [operations] Fixed issue where using a directive such as op.create_foreign_key() to
    create a self-referential constraint on a single table where the same
    column were present on both sides (e.g. within a composite foreign key)
    would produce an error under SQLAlchemy 2.0 and a warning under SQLAlchemy
    1.4 indicating that a duplicate column were being added to a table.

    References: #1215

misc

  • [autogenerate] [postgresql] Added support for autogenerate comparison of indexes on PostgreSQL which
    include SQL sort option, such as ASC or NULLS FIRST.

    References: #1213

1.10.3

05 Apr 19:40
Compare
Choose a tag to compare

1.10.3

Released: April 5, 2023

bug

  • [bug] [typing] Fixed various typing issues observed with pyright, including issues
    involving the combination of Function and
    MigrationContext.begin_transaction().

    References: #1191, #1201

  • [bug] [autogenerate] Fixed error raised by alembic when running autogenerate after removing
    a function based index.

    References: #1212

1.10.2

08 Mar 17:17
Compare
Choose a tag to compare

1.10.2

Released: March 8, 2023

bug

  • [bug] [ops] Fixed regression where Alembic would not run with older SQLAlchemy 1.3
    versions prior to 1.3.24 due to a missing symbol. Workarounds have been
    applied for older 1.3 versions.

    References: #1196

1.10.1

07 Mar 01:14
Compare
Choose a tag to compare

1.10.1

Released: March 6, 2023

bug

  • [bug] [postgresql] Fixed issue regarding PostgreSQL ExcludeConstraint, where
    constraint elements which made use of literal_column() could not be
    rendered for autogenerate. Additionally, using SQLAlchemy 2.0.5 or greater,
    text() constructs are also supported within PostgreSQL
    ExcludeConstraint objects for autogenerate render. Pull request
    courtesy Jan Katins.

    References: #1184

  • [bug] [batch] [regression] Fixed regression for 1.10.0 where Constraint objects were
    suddenly required to have non-None name fields when using batch mode, which
    was not previously a requirement.

    References: #1195

1.10.0

05 Mar 23:10
Compare
Choose a tag to compare

1.10.0

Released: March 5, 2023

feature

  • [feature] [revisioning] Recursive traversal of revision files in a particular revision directory is
    now supported, by indicating recursive_version_locations = true in
    alembic.ini. Pull request courtesy ostr00000.

    References: #760

usecase

  • [usecase] [autogenerate] [postgresql] Added support for autogenerate comparison of indexes on PostgreSQL which
    include SQL expressions, when using SQLAlchemy 2.0; the previous warning
    that such indexes were skipped are removed when the new functionality
    is in use. When using SQLAlchemy versions prior to the 2.0 series,
    the indexes continue to be skipped with a warning.

bug

  • [bug] [autogenerate] Fixed issue in index detection where autogenerate change detection would
    consider indexes with the same columns but with different order as equal,
    while in general they are not equivalent in how a database will use them.

    References: #1166

  • [bug] [autogenerate] [sqlite] Fixed issue where indexes on SQLite which include SQL expressions would not
    compare correctly, generating false positives under autogenerate. These
    indexes are now skipped, generating a warning, in the same way that
    expression-based indexes on PostgreSQL are skipped and generate warnings
    when SQLAlchemy 1.x installations are in use. Note that reflection of
    SQLite expression-based indexes continues to not yet be supported under
    SQLAlchemy 2.0, even though PostgreSQL expression-based indexes have now
    been implemented.

    References: #1165

  • [bug] [mssql] Properly escape constraint name on SQL Server when dropping
    a column while specifying mssql_drop_default=True or
    mssql_drop_check=True or mssql_drop_foreign_key=True.

    References: #1187

1.9.4

16 Feb 17:37
Compare
Choose a tag to compare

1.9.4

Released: February 16, 2023

bug

  • [bug] [mssql] Ongoing fixes for SQL Server server default comparisons under autogenerate,
    adjusting for SQL Server's collapsing of whitespace between SQL function
    arguments when reporting on a function-based server default, as well as its
    arbitrary addition of parenthesis within arguments; the approach has now
    been made more aggressive by stripping the two default strings to compare
    of all whitespace, parenthesis, and quoting characters.

    References: #1177

  • [bug] [postgresql] Fixed PostgreSQL server default comparison to handle SQL expressions
    sent as text() constructs, such as text("substring('name', 1, 3)"),
    which previously would raise errors when attempting to run a server-based
    comparison.

  • [bug] [autogenerate] Removed a mis-use of the
    EnvironmentContext.configure.render_item callable where the
    "server_default" renderer would be erroneously used within the server
    default comparison process, which is working against SQL expressions, not
    Python code.

    References: #1180

  • [bug] [commands] Fixed regression introduced in 1.7.0 where the "config" object passed to
    the template context when running the merge() command
    programmatically failed to be correctly populated. Pull request courtesy
    Brendan Gann.

1.9.3

07 Feb 20:48
Compare
Choose a tag to compare

1.9.3

Released: February 7, 2023

bug

  • [bug] [autogenerate] Fixed issue where rendering of user-defined types that then went onto use
    the .with_variant() method would fail to render, if using SQLAlchemy
    2.0's version of variants.

    References: #1167

1.9.2

14 Jan 19:15
Compare
Choose a tag to compare

1.9.2

Released: January 14, 2023

bug

  • [bug] [typing] Fixed typing definitions for EnvironmentContext.get_x_argument().

    Typing stubs are now generated for overloaded proxied methods such as
    EnvironmentContext.get_x_argument().

    References: #1146, #1147

  • [bug] [autogenerate] Fixed regression caused by #1145 where the string transformations
    applied to server defaults caused expressions such as (getdate()) to no
    longer compare as equivalent on SQL Server, others.

    References: #1152

1.9.1

23 Dec 19:28
Compare
Choose a tag to compare

1.9.1

Released: December 23, 2022

bug

  • [bug] [autogenerate] Fixed issue where server default compare would not work for string defaults
    that contained backslashes, due to mis-rendering of these values when
    comparing their contents.

    References: #1145

  • [bug] [oracle] Implemented basic server default comparison for the Oracle backend;
    previously, Oracle's formatting of reflected defaults prevented any
    matches from occurring.

  • [bug] [sqlite] Adjusted SQLite's compare server default implementation to better handle
    defaults with or without parens around them, from both the reflected and
    the local metadata side.

  • [bug] [mssql] Adjusted SQL Server's compare server default implementation to better
    handle defaults with or without parens around them, from both the reflected
    and the local metadata side.