From: Mike Bayer Date: Tue, 13 Jan 2026 17:05:09 +0000 (-0500) Subject: remove isolate_from_table for dropconstraint X-Git-Tag: rel_1_18_1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32b98547842e14a171a4c0fd24808587a0da1935;p=thirdparty%2Fsqlalchemy%2Falembic.git remove isolate_from_table for dropconstraint 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. Change-Id: I6af2a683660647980421b1ff761dcf53a61bb71a --- diff --git a/alembic/ddl/impl.py b/alembic/ddl/impl.py index 00dd7d86..f75cb77a 100644 --- a/alembic/ddl/impl.py +++ b/alembic/ddl/impl.py @@ -412,12 +412,11 @@ class DefaultImpl(metaclass=ImplMeta): def add_constraint(self, const: Any, **kw: Any) -> None: if const._create_rule is None or const._create_rule(self): if sqla_compat.sqla_2_1: + # this should be the default already kw.setdefault("isolate_from_table", True) self._exec(schema.AddConstraint(const, **kw)) def drop_constraint(self, const: Constraint, **kw: Any) -> None: - if sqla_compat.sqla_2_1: - kw.setdefault("isolate_from_table", True) self._exec(schema.DropConstraint(const, **kw)) def rename_table( diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index bb69fcc8..dea1b461 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -60,7 +60,7 @@ Changelog commands. .. change:: - :tags: usecase + :tags: usecase, operations Avoid deprecation warning in add/drop constraint added in SQLAlchemy 2.1. Ensure that alembic is compatible with the changes added in @@ -68,6 +68,11 @@ Changelog by explicitly setting ``isolate_from_table=True`` when running with SQLAlchemy 2.1 or greater. + .. note:: + + This change was revised in Alembic 1.18.1; futher developments + in SQLAlchemy 2.1 necessitated further adjustments. + .. change:: :tags: feature, autogenerate diff --git a/docs/build/unreleased/constraint_dep_revert.rst b/docs/build/unreleased/constraint_dep_revert.rst new file mode 100644 index 00000000..c816945d --- /dev/null +++ b/docs/build/unreleased/constraint_dep_revert.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: 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. +