MCPcopy
hub / github.com/psycopg/psycopg / fetchone

Method fetchone

psycopg/psycopg/cursor.py:239–253  ·  psycopg/psycopg/cursor.py::Cursor.fetchone

Return the next record from the current result set. Return `!None` the result set is finished. :rtype: Row | None, with Row defined by `row_factory`

(self)

Source from the content-addressed store, hash-verified

237 return self
238
239 def fetchone(self) -> Row | None:
240 class="st">"""
241 Return the next record from the current result set.
242
243 Return `!None` the result set is finished.
244
245 :rtype: Row | None, with Row defined by `row_factory`
246 class="st">"""
247 self._fetch_pipeline()
248 res = self._check_result_for_fetch()
249 if self._pos < res.ntuples:
250 record = self._tx.load_row(self._pos, self._make_row)
251 self._pos += 1
252 return record
253 return None
254
255 def fetchmany(self, size: int = 0) -> list[Row]:
256 class="st">"""

Callers 15

test_commit_errorFunction · 0.45
test_auto_transactionFunction · 0.45
test_autocommitFunction · 0.45
test_autocommit_propertyFunction · 0.45
test_autocommit_intransFunction · 0.45
test_executeFunction · 0.45
test_execute_binaryFunction · 0.45
test_row_factoryFunction · 0.45

Calls 3

_fetch_pipelineMethod · 0.95
load_rowMethod · 0.45

Tested by 15

test_commit_errorFunction · 0.36
test_auto_transactionFunction · 0.36
test_autocommitFunction · 0.36
test_autocommit_propertyFunction · 0.36
test_autocommit_intransFunction · 0.36
test_executeFunction · 0.36
test_execute_binaryFunction · 0.36
test_row_factoryFunction · 0.36