MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _copy

Method _copy

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

Source from the content-addressed store, hash-verified

4803 return self._copy(target_table=target_table, **kw)
4804
4805 def _copy(
4806 self,
4807 *,
4808 target_table: Optional[Table] = None,
4809 **kw: Any,
4810 ) -> ColumnCollectionConstraint:
4811 # ticket #5276
4812 constraint_kwargs = {}
4813 for dialect_name in self.dialect_options:
4814 dialect_options = self.dialect_options[dialect_name]._non_defaults
4815 for (
4816 dialect_option_key,
4817 dialect_option_value,
4818 ) in dialect_options.items():
4819 constraint_kwargs[dialect_name + "_" + dialect_option_key] = (
4820 dialect_option_value
4821 )
4822
4823 assert isinstance(self.parent, Table)
4824 c = self.__class__(
4825 name=self.name,
4826 deferrable=self.deferrable,
4827 initially=self.initially,
4828 *[
4829 _copy_expression(expr, self.parent, target_table)
4830 for expr in self._columns
4831 ],
4832 comment=self.comment,
4833 **constraint_kwargs,
4834 )
4835 return self._schema_item_copy(c)
4836
4837 def contains_column(self, col: Column[Any]) -> bool:
4838 """Return True if this constraint contains the given column.

Callers 1

copyMethod · 0.95

Calls 3

_copy_expressionFunction · 0.85
_schema_item_copyMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected