MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / has

Method has

lib/sqlalchemy/ext/associationproxy.py:1098–1120  ·  view source on GitHub ↗

Produce a proxied 'has' expression using EXISTS. This expression will be a composed product using the :meth:`.Relationship.Comparator.any` and/or :meth:`.Relationship.Comparator.has` operators of the underlying proxied attributes.

(
        self,
        criterion: Optional[_ColumnExpressionArgument[bool]] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

1096 )
1097
1098 def has(
1099 self,
1100 criterion: Optional[_ColumnExpressionArgument[bool]] = None,
1101 **kwargs: Any,
1102 ) -> ColumnElement[bool]:
1103 """Produce a proxied 'has' expression using EXISTS.
1104
1105 This expression will be a composed product
1106 using the :meth:`.Relationship.Comparator.any`
1107 and/or :meth:`.Relationship.Comparator.has`
1108 operators of the underlying proxied attributes.
1109
1110 """
1111 if self._unwrap_target_assoc_proxy is None and (
1112 not self.scalar
1113 or (self._target_is_object and not self._value_is_scalar)
1114 ):
1115 raise exc.InvalidRequestError(
1116 "'has()' not implemented for collections. Use any()."
1117 )
1118 return self._criterion_exists(
1119 criterion=criterion, is_has=True, **kwargs
1120 )
1121
1122 def __repr__(self) -> str:
1123 return "%s(%r)" % (self.__class__.__name__, self.parent)

Callers 6

containsMethod · 0.45
__eq__Method · 0.45
__ne__Method · 0.45
__call__Method · 0.45
configureMethod · 0.45
removeMethod · 0.45

Calls 1

_criterion_existsMethod · 0.95

Tested by

no test coverage detected