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])
| 1248 | ) from de |
| 1249 | |
| 1250 | def append_constraint(self, constraint: Union[Index, Constraint]) -> None: |
| 1251 | """Append a :class:`_schema.Constraint` to this |
| 1252 | :class:`_schema.Table`. |
| 1253 | |
| 1254 | This has the effect of the constraint being included in any |
| 1255 | future CREATE TABLE statement, assuming specific DDL creation |
| 1256 | events have not been associated with the given |
| 1257 | :class:`_schema.Constraint` object. |
| 1258 | |
| 1259 | Note that this does **not** produce the constraint within the |
| 1260 | relational database automatically, for a table that already exists |
| 1261 | in the database. To add a constraint to an |
| 1262 | existing relational database table, the SQL ALTER command must |
| 1263 | be used. SQLAlchemy also provides the |
| 1264 | :class:`.AddConstraint` construct which can produce this SQL when |
| 1265 | invoked as an executable clause. |
| 1266 | |
| 1267 | """ |
| 1268 | |
| 1269 | constraint._set_parent_with_dispatch(self) |
| 1270 | |
| 1271 | def _set_parent(self, parent: SchemaEventTarget, **kw: Any) -> None: |
| 1272 | metadata = parent |