MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _iter

Method _iter

lib/sqlalchemy/orm/query.py:2916–2937  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2914 raise
2915
2916 def _iter(self) -> Union[ScalarResult[_T], Result[_T]]:
2917 # new style execution.
2918 params = self._params
2919
2920 statement = self._statement_20()
2921 result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
2922 statement,
2923 params,
2924 execution_options={"_sa_orm_load_options": self.load_options},
2925 )
2926
2927 # legacy: automatically set scalars, unique
2928 if result._attributes.get("is_single_entity", False):
2929 result = cast("Result[_T]", result).scalars()
2930
2931 if (
2932 result._attributes.get("filtered", False)
2933 and not self.load_options._yield_per
2934 ):
2935 result = result.unique()
2936
2937 return result
2938
2939 def __str__(self) -> str:
2940 statement = self._statement_20()

Callers 5

allMethod · 0.95
firstMethod · 0.95
one_or_noneMethod · 0.95
oneMethod · 0.95
__iter__Method · 0.95

Calls 6

_statement_20Method · 0.95
castFunction · 0.50
executeMethod · 0.45
getMethod · 0.45
scalarsMethod · 0.45
uniqueMethod · 0.45

Tested by

no test coverage detected