@@ -207,7 +207,7 @@ def on_success(summary_metadata):
207207 async def __aiter__ (self ):
208208 """Iterator returning Records.
209209 :returns: Record, it is an immutable ordered collection of key-value pairs.
210- :rtype: :class:`neo4j.AsyncRecord `
210+ :rtype: :class:`neo4j.Record `
211211 """
212212 while self ._record_buffer or self ._attached :
213213 if self ._record_buffer :
@@ -316,17 +316,19 @@ async def consume(self):
316316
317317 Example::
318318
319- def create_node_tx(tx, name):
319+ async def create_node_tx(tx, name):
320320 result = await tx.run(
321321 "CREATE (n:ExampleNode { name: $name }) RETURN n", name=name
322322 )
323323 record = await result.single()
324324 value = record.value()
325- info = await result.consume()
326- return value, info
325+ summary = await result.consume()
326+ return value, summary
327327
328328 async with driver.session() as session:
329- node_id, info = await session.write_transaction(create_node_tx, "example")
329+ node_id, summary = await session.write_transaction(
330+ create_node_tx, "example"
331+ )
330332
331333 Example::
332334
@@ -337,13 +339,16 @@ async def get_two_tx(tx):
337339 if len(values) >= 2:
338340 break
339341 values.append(record.values())
342+ # or shorter: values = [record.values()
343+ # for record in await result.fetch(2)]
344+
340345 # discard the remaining records if there are any
341- info = await result.consume()
342- # use the info for logging etc.
343- return values, info
346+ summary = await result.consume()
347+ # use the summary for logging etc.
348+ return values, summary
344349
345- with driver.session() as session:
346- values, info = session.read_transaction(get_two_tx)
350+ async with driver.session() as session:
351+ values, summary = await session.read_transaction(get_two_tx)
347352
348353 :returns: The :class:`neo4j.ResultSummary` for this result
349354
@@ -424,7 +429,11 @@ async def fetch(self, n):
424429 :param n: the maximum number of records to fetch.
425430 :type n: int
426431
427- :returns: list of :class:`neo4j.AsyncRecord`
432+ :returns: list of :class:`neo4j.Record`
433+
434+ :raises ResultConsumedError: if the transaction from which this result
435+ was obtained has been closed or the Result has been explicitly
436+ consumed.
428437
429438 .. versionadded:: 5.0
430439 """
@@ -438,7 +447,8 @@ async def peek(self):
438447 """Obtain the next record from this result without consuming it.
439448 This leaves the record in the buffer for further processing.
440449
441- :returns: the next :class:`.Record` or :const:`None` if none remain
450+ :returns: the next :class:`neo4j.Record` or :const:`None` if none
451+ remain.
442452
443453 :raises ResultConsumedError: if the transaction from which this result
444454 was obtained has been closed or the Result has been explicitly
@@ -474,7 +484,7 @@ async def graph(self):
474484 async def value (self , key = 0 , default = None ):
475485 """Helper function that return the remainder of the result as a list of values.
476486
477- See :class:`neo4j.AsyncRecord .value`
487+ See :class:`neo4j.Record .value`
478488
479489 :param key: field to return for each remaining record. Obtain a single value from the record by index or key.
480490 :param default: default value, used if the index of key is unavailable
@@ -494,7 +504,7 @@ async def value(self, key=0, default=None):
494504 async def values (self , * keys ):
495505 """Helper function that return the remainder of the result as a list of values lists.
496506
497- See :class:`neo4j.AsyncRecord .values`
507+ See :class:`neo4j.Record .values`
498508
499509 :param keys: fields to return for each remaining record. Optionally filtering to include only certain values by index or key.
500510
@@ -513,7 +523,7 @@ async def values(self, *keys):
513523 async def data (self , * keys ):
514524 """Helper function that return the remainder of the result as a list of dictionaries.
515525
516- See :class:`neo4j.AsyncRecord .data`
526+ See :class:`neo4j.Record .data`
517527
518528 :param keys: fields to return for each remaining record. Optionally filtering to include only certain values by index or key.
519529
0 commit comments