MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / visit_binary

Method visit_binary

lib/sqlalchemy/orm/relationships.py:2684–2701  ·  view source on GitHub ↗
(binary: BinaryExpression[Any])

Source from the content-addressed store, hash-verified

2682 return None
2683
2684 def visit_binary(binary: BinaryExpression[Any]) -> None:
2685 if not isinstance(
2686 binary.left, sql.ColumnElement
2687 ) or not isinstance(binary.right, sql.ColumnElement):
2688 return
2689
2690 if (
2691 "foreign" not in binary.left._annotations
2692 and "foreign" not in binary.right._annotations
2693 ):
2694 col = is_foreign(binary.left, binary.right)
2695 if col is not None:
2696 if col.compare(binary.left):
2697 binary.left = binary.left._annotate({"foreign": True})
2698 elif col.compare(binary.right):
2699 binary.right = binary.right._annotate(
2700 {"foreign": True}
2701 )
2702
2703 self.primaryjoin = visitors.cloned_traverse(
2704 self.primaryjoin, {}, {"binary": visit_binary}

Callers

nothing calls this directly

Calls 6

compareMethod · 0.45
_annotateMethod · 0.45
is_derived_fromMethod · 0.45
addMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected