Represent an ALTER TABLE DROP CONSTRAINT statement.
| 1160 | |
| 1161 | |
| 1162 | class DropConstraint(_DropBase["Constraint"]): |
| 1163 | """Represent an ALTER TABLE DROP CONSTRAINT statement.""" |
| 1164 | |
| 1165 | __visit_name__ = "drop_constraint" |
| 1166 | |
| 1167 | def __init__( |
| 1168 | self, |
| 1169 | element: Constraint, |
| 1170 | *, |
| 1171 | cascade: bool = False, |
| 1172 | if_exists: bool = False, |
| 1173 | isolate_from_table: bool | _NoArg = NO_ARG, |
| 1174 | **kw: Any, |
| 1175 | ) -> None: |
| 1176 | """Construct a new :class:`.DropConstraint` construct. |
| 1177 | |
| 1178 | :param element: a :class:`.Constraint` object |
| 1179 | |
| 1180 | :param cascade: optional boolean, indicates backend-specific |
| 1181 | "CASCADE CONSTRAINT" directive should be rendered if available |
| 1182 | |
| 1183 | :param if_exists: optional boolean, indicates backend-specific |
| 1184 | "IF EXISTS" directive should be rendered if available |
| 1185 | |
| 1186 | :param isolate_from_table: optional boolean. This is a deprecated |
| 1187 | setting that when ``True``, does the same thing that |
| 1188 | :paramref:`.AddConstraint.isolate_from_table` does, which is prevents |
| 1189 | the constraint from being associated with an inline ``CREATE TABLE`` |
| 1190 | statement. It does not have any effect on the DROP process for a |
| 1191 | table and is an artifact of older SQLAlchemy versions, |
| 1192 | and will be removed in a future release. |
| 1193 | |
| 1194 | .. versionadded:: 2.0.39 - added |
| 1195 | :paramref:`.DropConstraint.isolate_from_table`, defaulting |
| 1196 | to True. Previously, the behavior of this parameter was implicitly |
| 1197 | turned on in all cases. |
| 1198 | |
| 1199 | .. versionchanged:: 2.1 - This parameter has been deprecated and |
| 1200 | the default value of the flag was changed to ``False``. |
| 1201 | |
| 1202 | """ |
| 1203 | self.cascade = cascade |
| 1204 | super().__init__(element, if_exists=if_exists, **kw) |
| 1205 | |
| 1206 | if isolate_from_table is not NO_ARG: |
| 1207 | util.warn_deprecated( |
| 1208 | "The ``isolate_from_table`` is deprecated and it be removed " |
| 1209 | "in a future release.", |
| 1210 | "2.1", |
| 1211 | ) |
| 1212 | |
| 1213 | if isolate_from_table: |
| 1214 | element._create_rule = self._create_rule_disable |
| 1215 | |
| 1216 | |
| 1217 | class SetTableComment(_CreateDropBase["Table"]): |
no outgoing calls