MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / append_constraint

Method append_constraint

lib/sqlalchemy/sql/schema.py:1507–1526  ·  view source on GitHub ↗

Append a :class:`_schema.Constraint` to this :class:`_schema.Table`. This has the effect of the constraint being included in any future CREATE TABLE statement, assuming specific DDL creation events have not been associated with the given :class:`_schema.Const

(self, constraint: Union[Index, Constraint])

Source from the content-addressed store, hash-verified

1505 self._insert_col_impl(column, replace_existing=replace_existing)
1506
1507 def append_constraint(self, constraint: Union[Index, Constraint]) -> None:
1508 """Append a :class:`_schema.Constraint` to this
1509 :class:`_schema.Table`.
1510
1511 This has the effect of the constraint being included in any
1512 future CREATE TABLE statement, assuming specific DDL creation
1513 events have not been associated with the given
1514 :class:`_schema.Constraint` object.
1515
1516 Note that this does **not** produce the constraint within the
1517 relational database automatically, for a table that already exists
1518 in the database. To add a constraint to an
1519 existing relational database table, the SQL ALTER command must
1520 be used. SQLAlchemy also provides the
1521 :class:`.AddConstraint` construct which can produce this SQL when
1522 invoked as an executable clause.
1523
1524 """
1525
1526 constraint._set_parent_with_dispatch(self)
1527
1528 def _set_parent(self, parent: SchemaEventTarget, **kw: Any) -> None:
1529 metadata = parent

Calls 1