Releases: sqlalchemy/alembic
1.14.0
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
1.13.3
Released: September 23, 2024
usecase
-
[usecase] [autogenerate] Render
if_exists
andif_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 customRewriter
in theenv.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
inpyproject.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
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 PostgreSQLReferences: #1479
1.13.1
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 multipleprocess_revision_directives
callables to be chained. Pull request courtesy zrotceh.References: #1337
-
[bug] [environment] Fixed issue where the method
EnvironmentContext.get_x_argument()
using theEnvironmentContext.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
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 thebackports.zoneinfo
library. Thealembic[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.
1.12.1
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 ofTable
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 theMigrationOperation
base class,
and added typing to the example atcookbook_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 correctto_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. -
[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 ofOperations.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 generatedtext()
construct.References: #1322
1.12.0
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 theexec
runner, it complements the existing
console_scripts
runner by allowing non-Python tools such asruff
to
be used. Pull request courtesy Mihail Milushev.References: #1275
usecase
-
[usecase] [autogenerate] Change the default value of
EnvironmentContext.configure.compare_type
toTrue
.
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 thetype_
parameter to beNone
for this case. Autogenerate has also been
enhanced to exclude thetype_
parameter from rendering within this
command whentype_
isNone
. Pull request courtesy David Hills.References: #1300
-
[bug] [commmands] Fixed issue where the
revision_environment
directive inalembic.ini
was ignored by thealembic merge
command, leading to issues when other
configurational elements depend uponenv.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
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 featurePYTHONWARNDEFAULTENCODING
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
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
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 thetable_name
parameter
toOperations.drop_index()
, which was generated positionally by
autogenerate prior to version 0.6.3 released in 2014, andtype_
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. -
[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
immutableMapping[str, str]
. When a section is returned and the default
is not used, a mutable dictionary is returned.References: #1244