MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / DropConstraint

Class DropConstraint

lib/sqlalchemy/sql/ddl.py:789–827  ·  view source on GitHub ↗

Represent an ALTER TABLE DROP CONSTRAINT statement.

Source from the content-addressed store, hash-verified

787
788
789class DropConstraint(_DropBase["Constraint"]):
790 """Represent an ALTER TABLE DROP CONSTRAINT statement."""
791
792 __visit_name__ = "drop_constraint"
793
794 def __init__(
795 self,
796 element: Constraint,
797 *,
798 cascade: bool = False,
799 if_exists: bool = False,
800 isolate_from_table: bool = True,
801 **kw: Any,
802 ) -> None:
803 """Construct a new :class:`.DropConstraint` construct.
804
805 :param element: a :class:`.Constraint` object
806 :param cascade: optional boolean, indicates backend-specific
807 "CASCADE CONSTRAINT" directive should be rendered if available
808 :param if_exists: optional boolean, indicates backend-specific
809 "IF EXISTS" directive should be rendered if available
810 :param isolate_from_table: optional boolean, defaults to True. Has
811 the effect of the incoming constraint being isolated from being
812 included in a CREATE TABLE sequence when associated with a
813 :class:`.Table`.
814
815 .. versionadded:: 2.0.39 - added
816 :paramref:`.DropConstraint.isolate_from_table`, defaulting
817 to True. Previously, the behavior of this parameter was implicitly
818 turned on in all cases.
819
820 """
821 self.cascade = cascade
822 super().__init__(element, if_exists=if_exists, **kw)
823
824 if isolate_from_table:
825 element._create_rule = util.portable_instancemethod(
826 self._create_rule_disable
827 )
828
829
830class SetTableComment(_CreateDropBase["Table"]):

Calls

no outgoing calls

Tested by 1