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

Method is_foreign

lib/sqlalchemy/orm/relationships.py:2584–2599  ·  view source on GitHub ↗
(
            a: ColumnElement[Any], b: ColumnElement[Any]
        )

Source from the content-addressed store, hash-verified

2582 secondarycols = set()
2583
2584 def is_foreign(
2585 a: ColumnElement[Any], b: ColumnElement[Any]
2586 ) -> Optional[ColumnElement[Any]]:
2587 if isinstance(a, schema.Column) and isinstance(b, schema.Column):
2588 if a.references(b):
2589 return a
2590 elif b.references(a):
2591 return b
2592
2593 if secondarycols:
2594 if a in secondarycols and b not in secondarycols:
2595 return a
2596 elif b in secondarycols and a not in secondarycols:
2597 return b
2598
2599 return None
2600
2601 def visit_binary(binary: BinaryExpression[Any]) -> None:
2602 if not isinstance(

Callers

nothing calls this directly

Calls 1

referencesMethod · 0.45

Tested by

no test coverage detected