MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / is_foreign

Method is_foreign

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

Source from the content-addressed store, hash-verified

2665 secondarycols = set()
2666
2667 def is_foreign(
2668 a: ColumnElement[Any], b: ColumnElement[Any]
2669 ) -> Optional[ColumnElement[Any]]:
2670 if isinstance(a, schema.Column) and isinstance(b, schema.Column):
2671 if a.references(b):
2672 return a
2673 elif b.references(a):
2674 return b
2675
2676 if secondarycols:
2677 if a in secondarycols and b not in secondarycols:
2678 return a
2679 elif b in secondarycols and a not in secondarycols:
2680 return b
2681
2682 return None
2683
2684 def visit_binary(binary: BinaryExpression[Any]) -> None:
2685 if not isinstance(

Callers

nothing calls this directly

Calls 1

referencesMethod · 0.45

Tested by

no test coverage detected