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

Method fetchmany

psycopg/psycopg/cursor_async.py:257–274  ·  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

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

Callers

nothing calls this directly

Calls 3

_fetch_pipelineMethod · 0.95
load_rowsMethod · 0.45

Tested by

no test coverage detected