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

Method _copy

lib/sqlalchemy/sql/schema.py:3252–3280  ·  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

3250 return self._copy(schema=schema, **kw)
3251
3252 def _copy(self, *, schema: Optional[str] = None, **kw: Any) -> ForeignKey:
3253 """Produce a copy of this :class:`_schema.ForeignKey` object.
3254
3255 The new :class:`_schema.ForeignKey` will not be bound
3256 to any :class:`_schema.Column`.
3257
3258 This method is usually used by the internal
3259 copy procedures of :class:`_schema.Column`, :class:`_schema.Table`,
3260 and :class:`_schema.MetaData`.
3261
3262 :param schema: The returned :class:`_schema.ForeignKey` will
3263 reference the original table and column name, qualified
3264 by the given string schema name.
3265
3266 """
3267 fk = ForeignKey(
3268 self._get_colspec(schema=schema),
3269 use_alter=self.use_alter,
3270 name=self.name,
3271 onupdate=self.onupdate,
3272 ondelete=self.ondelete,
3273 deferrable=self.deferrable,
3274 initially=self.initially,
3275 link_to_name=self.link_to_name,
3276 match=self.match,
3277 comment=self.comment,
3278 **self._unvalidated_dialect_kw,
3279 )
3280 return self._schema_item_copy(fk)
3281
3282 def _get_colspec(
3283 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