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

Method get_referent

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

3050 return table.corresponding_column(self.column) is not None
3051
3052 def get_referent(self, table: FromClause) -> Optional[Column[Any]]:
3053 """Return the :class:`_schema.Column` in the given
3054 :class:`_schema.Table` (or any :class:`.FromClause`)
3055 referenced by this :class:`_schema.ForeignKey`.
3056
3057 Returns None if this :class:`_schema.ForeignKey`
3058 does not reference the given
3059 :class:`_schema.Table`.
3060
3061 """
3062 # our column is a Column, and any subquery etc. proxying us
3063 # would be doing so via another Column, so that's what would
3064 # be returned here
3065 return table.columns.corresponding_column(self.column) # type: ignore
3066
3067 @util.memoized_property
3068 def _column_tokens(self) -> Tuple[Optional[str], str, Optional[str]]:

Calls 1

corresponding_columnMethod · 0.45