Skip to content

Commit 32b9854

Browse files
committed
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
1 parent 7955bac commit 32b9854

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

alembic/ddl/impl.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,11 @@ def drop_column(
412412
def add_constraint(self, const: Any, **kw: Any) -> None:
413413
if const._create_rule is None or const._create_rule(self):
414414
if sqla_compat.sqla_2_1:
415+
# this should be the default already
415416
kw.setdefault("isolate_from_table", True)
416417
self._exec(schema.AddConstraint(const, **kw))
417418

418419
def drop_constraint(self, const: Constraint, **kw: Any) -> None:
419-
if sqla_compat.sqla_2_1:
420-
kw.setdefault("isolate_from_table", True)
421420
self._exec(schema.DropConstraint(const, **kw))
422421

423422
def rename_table(

docs/build/changelog.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,19 @@ Changelog
6060
commands.
6161

6262
.. change::
63-
:tags: usecase
63+
:tags: usecase, operations
6464

6565
Avoid deprecation warning in add/drop constraint added in SQLAlchemy 2.1.
6666
Ensure that alembic is compatible with the changes added in
6767
https://github.com/sqlalchemy/sqlalchemy/issues/13006
6868
by explicitly setting ``isolate_from_table=True`` when running with
6969
SQLAlchemy 2.1 or greater.
7070

71+
.. note::
72+
73+
This change was revised in Alembic 1.18.1; futher developments
74+
in SQLAlchemy 2.1 necessitated further adjustments.
75+
7176
.. change::
7277
:tags: feature, autogenerate
7378

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. change::
2+
:tags: bug, operations
3+
4+
Revised the change regarding SQLAlchemy 2.1 and deprecation warnings
5+
related to ``isolate_from_table=True``. Further developments in release 2.1
6+
have revised how this parameter will be modified.
7+

0 commit comments

Comments
 (0)