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

Method visit_binary

lib/sqlalchemy/sql/compiler.py:3556–3610  ·  view source on GitHub ↗
(
        self,
        binary,
        override_operator=None,
        eager_grouping=False,
        from_linter=None,
        lateral_from_linter=None,
        **kw,
    )

Source from the content-addressed store, hash-verified

3554 return to_update, replacement_expression
3555
3556 def visit_binary(
3557 self,
3558 binary,
3559 override_operator=None,
3560 eager_grouping=False,
3561 from_linter=None,
3562 lateral_from_linter=None,
3563 **kw,
3564 ):
3565 if from_linter and operators.is_comparison(binary.operator):
3566 if lateral_from_linter is not None:
3567 enclosing_lateral = kw["enclosing_lateral"]
3568 lateral_from_linter.edges.update(
3569 itertools.product(
3570 _de_clone(
3571 binary.left._from_objects + [enclosing_lateral]
3572 ),
3573 _de_clone(
3574 binary.right._from_objects + [enclosing_lateral]
3575 ),
3576 )
3577 )
3578 else:
3579 from_linter.edges.update(
3580 itertools.product(
3581 _de_clone(binary.left._from_objects),
3582 _de_clone(binary.right._from_objects),
3583 )
3584 )
3585
3586 # don't allow "? = ?" to render
3587 if (
3588 self.ansi_bind_rules
3589 and isinstance(binary.left, elements.BindParameter)
3590 and isinstance(binary.right, elements.BindParameter)
3591 ):
3592 kw["literal_execute"] = True
3593
3594 operator_ = override_operator or binary.operator
3595 disp = self._get_operator_dispatch(operator_, "binary", None)
3596 if disp:
3597 return disp(binary, operator_, **kw)
3598 else:
3599 try:
3600 opstring = OPERATORS[operator_]
3601 except KeyError as err:
3602 raise exc.UnsupportedCompilationError(self, operator_) from err
3603 else:
3604 return self._generate_generic_binary(
3605 binary,
3606 opstring,
3607 from_linter=from_linter,
3608 lateral_from_linter=lateral_from_linter,
3609 **kw,
3610 )
3611
3612 def visit_function_as_comparison_op_binary(self, element, operator, **kw):
3613 return self.process(element.sql_function, **kw)

Callers 1

Calls 5

_de_cloneFunction · 0.85
is_comparisonMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected