MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_referent

Method get_referent

lib/sqlalchemy/sql/schema.py:3359–3372  ·  view source on GitHub ↗

Return the :class:`_schema.Column` in the given :class:`_schema.Table` (or any :class:`.FromClause`) referenced by this :class:`_schema.ForeignKey`. Returns None if this :class:`_schema.ForeignKey` does not reference the given :class:`_schema.Table`.

(self, table: FromClause)

Source from the content-addressed store, hash-verified

3357 return table.corresponding_column(self.column) is not None
3358
3359 def get_referent(self, table: FromClause) -> Optional[Column[Any]]:
3360 """Return the :class:`_schema.Column` in the given
3361 :class:`_schema.Table` (or any :class:`.FromClause`)
3362 referenced by this :class:`_schema.ForeignKey`.
3363
3364 Returns None if this :class:`_schema.ForeignKey`
3365 does not reference the given
3366 :class:`_schema.Table`.
3367
3368 """
3369 # our column is a Column, and any subquery etc. proxying us
3370 # would be doing so via another Column, so that's what would
3371 # be returned here
3372 return table.columns.corresponding_column(self.column) # type: ignore
3373
3374 @util.memoized_property
3375 def _column_tokens(self) -> Tuple[Optional[str], str, Optional[str]]:

Calls 1

corresponding_columnMethod · 0.45