MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / yield_per

Method yield_per

lib/sqlalchemy/engine/result.py:1949–1958  ·  view source on GitHub ↗
(self, num: int)

Source from the content-addressed store, hash-verified

1947
1948 @_generative
1949 def yield_per(self, num: int) -> Self:
1950 # TODO: this throws away the iterator which may be holding
1951 # onto a chunk. the yield_per cannot be changed once any
1952 # rows have been fetched. either find a way to enforce this,
1953 # or we can't use itertools.chain and will instead have to
1954 # keep track.
1955
1956 self._yield_per = num
1957 self.iterator = itertools.chain.from_iterable(self.chunks(num))
1958 return self
1959
1960 def _soft_close(self, hard: bool = False, **kw: Any) -> None:
1961 super()._soft_close(hard=hard, **kw)

Callers 1

instancesFunction · 0.95

Calls 1

chunksMethod · 0.80

Tested by

no test coverage detected