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

Method _copy

lib/sqlalchemy/sql/schema.py:2950–2978  ·  view source on GitHub ↗

Produce a copy of this :class:`_schema.ForeignKey` object. The new :class:`_schema.ForeignKey` will not be bound to any :class:`_schema.Column`. This method is usually used by the internal copy procedures of :class:`_schema.Column`, :class:`_schema.Table`, a

(self, *, schema: Optional[str] = None, **kw: Any)

Source from the content-addressed store, hash-verified

2948 return self._copy(schema=schema, **kw)
2949
2950 def _copy(self, *, schema: Optional[str] = None, **kw: Any) -> ForeignKey:
2951 """Produce a copy of this :class:`_schema.ForeignKey` object.
2952
2953 The new :class:`_schema.ForeignKey` will not be bound
2954 to any :class:`_schema.Column`.
2955
2956 This method is usually used by the internal
2957 copy procedures of :class:`_schema.Column`, :class:`_schema.Table`,
2958 and :class:`_schema.MetaData`.
2959
2960 :param schema: The returned :class:`_schema.ForeignKey` will
2961 reference the original table and column name, qualified
2962 by the given string schema name.
2963
2964 """
2965 fk = ForeignKey(
2966 self._get_colspec(schema=schema),
2967 use_alter=self.use_alter,
2968 name=self.name,
2969 onupdate=self.onupdate,
2970 ondelete=self.ondelete,
2971 deferrable=self.deferrable,
2972 initially=self.initially,
2973 link_to_name=self.link_to_name,
2974 match=self.match,
2975 comment=self.comment,
2976 **self._unvalidated_dialect_kw,
2977 )
2978 return self._schema_item_copy(fk)
2979
2980 def _get_colspec(
2981 self,

Callers 2

copyMethod · 0.95
test_fk_copyMethod · 0.95

Calls 3

_get_colspecMethod · 0.95
ForeignKeyClass · 0.85
_schema_item_copyMethod · 0.80

Tested by 1

test_fk_copyMethod · 0.76