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

Method _copy

lib/sqlalchemy/sql/schema.py:4562–4583  ·  view source on GitHub ↗
(
        self, *, target_table: Optional[Table] = None, **kw: Any
    )

Source from the content-addressed store, hash-verified

4560 return self._copy(target_table=target_table, **kw)
4561
4562 def _copy(
4563 self, *, target_table: Optional[Table] = None, **kw: Any
4564 ) -> CheckConstraint:
4565 if target_table is not None:
4566 # note that target_table is None for the copy process of
4567 # a column-bound CheckConstraint, so this path is not reached
4568 # in that case.
4569 sqltext = _copy_expression(self.sqltext, self.table, target_table)
4570 else:
4571 sqltext = self.sqltext
4572 c = CheckConstraint(
4573 sqltext,
4574 name=self.name,
4575 initially=self.initially,
4576 deferrable=self.deferrable,
4577 _create_rule=self._create_rule,
4578 table=target_table,
4579 comment=self.comment,
4580 _autoattach=False,
4581 _type_bound=self._type_bound,
4582 )
4583 return self._schema_item_copy(c)
4584
4585
4586class ForeignKeyConstraint(ColumnCollectionConstraint):

Callers 3

copyMethod · 0.95

Calls 3

_copy_expressionFunction · 0.85
CheckConstraintClass · 0.85
_schema_item_copyMethod · 0.80

Tested by 2