MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/schema.py:4485–4540  ·  view source on GitHub ↗

r"""Create a SQL constraint. :param name: Optional, the in-database name of this ``Constraint``. :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when issuing DDL for this constraint. :param initially: Opt

(
        self,
        name: _ConstraintNameArgument = None,
        deferrable: Optional[bool] = None,
        initially: Optional[str] = None,
        info: Optional[_InfoType] = None,
        comment: Optional[str] = None,
        _create_rule: Optional[Any] = None,
        _type_bound: bool = False,
        **dialect_kw: Any,
    )

Source from the content-addressed store, hash-verified

4483 _column_flag: bool
4484
4485 def __init__(
4486 self,
4487 name: _ConstraintNameArgument = None,
4488 deferrable: Optional[bool] = None,
4489 initially: Optional[str] = None,
4490 info: Optional[_InfoType] = None,
4491 comment: Optional[str] = None,
4492 _create_rule: Optional[Any] = None,
4493 _type_bound: bool = False,
4494 **dialect_kw: Any,
4495 ) -> None:
4496 r"""Create a SQL constraint.
4497
4498 :param name:
4499 Optional, the in-database name of this ``Constraint``.
4500
4501 :param deferrable:
4502 Optional bool. If set, emit DEFERRABLE or NOT DEFERRABLE when
4503 issuing DDL for this constraint.
4504
4505 :param initially:
4506 Optional string. If set, emit INITIALLY <value> when issuing DDL
4507 for this constraint.
4508
4509 :param info: Optional data dictionary which will be populated into the
4510 :attr:`.SchemaItem.info` attribute of this object.
4511
4512 :param comment: Optional string that will render an SQL comment on
4513 foreign key constraint creation.
4514
4515 .. versionadded:: 2.0
4516
4517 :param \**dialect_kw: Additional keyword arguments are dialect
4518 specific, and passed in the form ``<dialectname>_<argname>``. See
4519 the documentation regarding an individual dialect at
4520 :ref:`dialect_toplevel` for detail on documented arguments.
4521
4522 :param _create_rule:
4523 used internally by some datatypes that also create constraints.
4524
4525 :param _type_bound:
4526 used internally to indicate that this constraint is associated with
4527 a specific datatype.
4528
4529 """
4530
4531 self.name = name
4532 self.deferrable = deferrable
4533 self.initially = initially
4534 if info:
4535 self.info = info
4536 self._create_rule = _create_rule
4537 self._type_bound = _type_bound
4538 util.set_creation_order(self)
4539 self._validate_dialect_kwargs(dialect_kw)
4540 self.comment = comment
4541
4542 def _should_create_for_compiler(

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected