github sqlalchemy/alembic rel_1_5_0
1.5.0

latest releases: rel_1_14_0, rel_1_13_3, rel_1_13_2...
3 years ago

1.5.0

Released: January 18, 2021

changed

  • [changed] [environment] To accommodate SQLAlchemy 1.4 and 2.0, the migration model now no longer
    assumes that the SQLAlchemy Connection will autocommit an individual
    operation. This essentially means that for databases that use
    non-transactional DDL (pysqlite current driver behavior, MySQL), there is
    still a BEGIN/COMMIT block that will surround each individual migration.
    Databases that support transactional DDL should continue to have the
    same flow, either per migration or per-entire run, depending on the
    value of the Environment.configure.transaction_per_migration
    flag.

  • [changed] [environment] A CommandError is raised if a sqlalchemy.engine.Engine is
    passed to the MigrationContext.configure() method instead of a
    sqlalchemy.engine.Connection object. Previously, this would be a
    warning only.

  • [changed] Alembic 1.5.0 now supports Python 2.7 and Python 3.6 and above, as well
    as SQLAlchemy 1.3.0 and above. Support is removed for Python 3
    versions prior to 3.6 and SQLAlchemy versions prior to the 1.3 series.

    References: #748

feature

  • [feature] [autogenerate] Added new hook EnvironmentContext.configure.include_name,
    which complements the
    EnvironmentContext.configure.include_object hook by providing
    a means of preventing objects of a certain name from being autogenerated
    before the SQLAlchemy reflection process takes place, and notably
    includes explicit support for passing each schema name when
    EnvironmentContext.configure.include_schemas is set to True.
    This is most important especially for enviroments that make use of
    EnvironmentContext.configure.include_schemas where schemas are
    actually databases (e.g. MySQL) in order to prevent reflection sweeps of
    the entire server.

    References: #650

  • [feature] [versioning] The revision tree is now checked for cycles and loops between revision
    files when the revision environment is loaded up. Scenarios such as a
    revision pointing to itself, or a revision that can reach itself via a
    loop, are handled and will raise the CycleDetected exception when
    the environment is loaded (expressed from the Alembic commandline as a
    failure message and nonzero return code). Previously, these situations were
    silently ignored up front, and the behavior of revision traversal would
    either be silently incorrect, or would produce errors such as
    RangeNotAncestorError. Pull request courtesy Koichiro Den.

    References: #757

bug

  • [bug] [operations] Modified the add_column() operation such that the Column object in
    use is shallow copied to a new instance if that Column is already
    attached to a table() or Table. This accommodates for the change
    made in SQLAlchemy issue #5618 which prohibits a Column from being
    associated with multiple table() objects. This resumes support for
    using a Column inside of an Alembic operation that already refers to a
    parent table() or Table as well as allows operation objects just
    autogenerated to work.

    References: #753

  • [bug] [autogenerate] Added rendering for the Table.prefixes element to autogenerate so that
    the rendered Python code includes these directives. Pull request courtesy
    Rodrigo Ce Moretto.

    References: #721

  • [bug] [batch] Added missing "create comment" feature for columns that are altered in
    batch migrations.

    References: #761

  • [bug] [batch] Made an adjustment to the PostgreSQL dialect to allow it to work more
    effectively in batch mode, where a datatype like Boolean or non-native Enum
    that may have embedded rules to generate CHECK constraints will be more
    correctly handled in that these constraints usually will not have been
    generated on the PostgreSQL backend; previously it would inadvertently
    assume they existed unconditionally in a special PG-only "drop constraint"
    step.

    References: #773

usecase

  • [usecase] [operations] Added support for rendering of "identity" elements on
    Column objects, supported in SQLAlchemy via
    the Identity element introduced in version 1.4.

    Adding columns with identity is supported on PostgreSQL,
    MSSQL and Oracle. Changing the identity options or removing
    it is supported only on PostgreSQL and Oracle.

    References: #730

  • [usecase] [commands] Add __main__.py file to alembic package to support invocation
    with python -m alembic.

removed

  • [removed] [autogenerate] The long deprecated
    EnvironmentContext.configure.include_symbol hook is removed.
    The EnvironmentContext.configure.include_object
    and EnvironmentContext.configure.include_name
    hooks both achieve the goals of this hook.

  • [removed] [commands] Removed deprecated --head_only option to the alembic current
    command

  • [removed] [operations] Removed legacy parameter names from operations, these have been emitting
    warnings since version 0.8. In the case that legacy version files have not
    yet been updated, these can be modified directly in order to maintain
    compatibility:

    -   `Operations.drop_constraint()` - "type" (use "type_") and "name"
        (use "constraint_name")
    
    -   `Operations.create_primary_key()` - "cols" (use "columns") and
        "name" (use "constraint_name")
    
    -   `Operations.create_unique_constraint()` - "name" (use
        "constraint_name"), "source" (use "table_name") and "local_cols" (use
        "columns")
    
    -   `Operations.batch_create_unique_constraint()` - "name" (use
        "constraint_name")
    
    -   `Operations.create_foreign_key()` - "name" (use "constraint_name"),
        "source" (use "source_table"), "referent" (use "referent_table")
    
    -   `Operations.batch_create_foreign_key()` - "name" (use
        "constraint_name"), "referent" (use "referent_table")
    
    -   `Operations.create_check_constraint()` - "name" (use
        "constraint_name"), "source" (use "table_name")
    
    -   `Operations.batch_create_check_constraint()` - "name" (use
        "constraint_name")
    
    -   `Operations.create_index()` - "name" (use "index_name")
    
    -   `Operations.drop_index()` - "name" (use "index_name"), "tablename"
        (use "table_name")
    
    -   `Operations.batch_drop_index()` - "name" (use "index_name"),
    
    -   `Operations.create_table()` - "name" (use "table_name")
    
    -   `Operations.drop_table()` - "name" (use "table_name")
    
    -   `Operations.alter_column()` - "name" (use "new_column_name")
    

Don't miss a new alembic release

NewReleases is sending notifications on new releases.