MCPcopy
hub / github.com/psycopg/psycopg / fetchmany

Method fetchmany

psycopg/psycopg/cursor.py:255–272  ·  view source on GitHub ↗

Return the next `!size` records from the current result set. `!size` default to `!self.arraysize` if not specified. :rtype: Sequence[Row], with Row defined by `row_factory`

(self, size: int = 0)

Source from the content-addressed store, hash-verified

253 return None
254
255 def fetchmany(self, size: int = 0) -> list[Row]:
256 """
257 Return the next `!size` records from the current result set.
258
259 `!size` default to `!self.arraysize` if not specified.
260
261 :rtype: Sequence[Row], with Row defined by `row_factory`
262 """
263 self._fetch_pipeline()
264 res = self._check_result_for_fetch()
265
266 if not size:
267 size = self.arraysize
268 records = self._tx.load_rows(
269 self._pos, min(self._pos + size, res.ntuples), self._make_row
270 )
271 self._pos += len(records)
272 return records
273
274 def fetchall(self) -> list[Row]:
275 """

Callers 15

workFunction · 0.45
workFunction · 0.45
test_fetchmanyMethod · 0.45
test_mixedfetchMethod · 0.45
workFunction · 0.45
workFunction · 0.45
test_fetchmanyFunction · 0.45
test_rownumberFunction · 0.45
test_steal_cursorFunction · 0.45

Calls 3

_fetch_pipelineMethod · 0.95
load_rowsMethod · 0.45

Tested by 15

workFunction · 0.36
workFunction · 0.36
test_fetchmanyMethod · 0.36
test_mixedfetchMethod · 0.36
workFunction · 0.36
workFunction · 0.36
test_fetchmanyFunction · 0.36
test_rownumberFunction · 0.36
test_steal_cursorFunction · 0.36