You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/api.rst
+48-17
Original file line number
Diff line number
Diff line change
@@ -167,7 +167,7 @@ Specify whether TCP keep-alive should be enabled.
167
167
:Type: ``bool``
168
168
:Default: ``True``
169
169
170
-
**This is experimental.**
170
+
**This is experimental.** (See :ref:`filter-warnings-ref`)
171
171
172
172
173
173
.. _max-connection-lifetime-ref:
@@ -516,12 +516,31 @@ Auto-commit transactions are the simplest form of transaction, available via :py
516
516
These are easy to use but support only one statement per transaction and are not automatically retried on failure.
517
517
Auto-commit transactions are also the only way to run ``PERIODIC COMMIT`` statements, since this Cypher clause manages its own transactions internally.
value = session.read_transaction(do_cypher, "RETURN 1")
354
+
with driver.session() as session:
355
+
values = session.read_transaction(do_cypher_tx, "RETURN 1 AS x")
356
+
357
+
Example::
358
+
359
+
def get_two_tx(tx):
360
+
result = tx.run("UNWIND [1,2,3,4] AS x RETURN x")
361
+
values = []
362
+
for ix, record in enumerate(result):
363
+
if x > 1:
364
+
break
365
+
values.append(record.values())
366
+
info = result.consume() # discard the remaining records if there are any
367
+
# use the info for logging etc.
368
+
return values
369
+
370
+
with driver.session() as session:
371
+
values = session.read_transaction(get_two_tx)
353
372
354
373
:param transaction_function: a function that takes a transaction as an argument and does work with the transaction. `tx_function(tx, \*args, \*\*kwargs)`
355
374
:param args: arguments for the `transaction_function`
value = session.write_transaction(do_cypher, "RETURN 1")
376
397
377
398
:param transaction_function: a function that takes a transaction as an argument and does work with the transaction. `tx_function(tx, \*args, \*\*kwargs)`
378
399
:param args: key word arguments for the `transaction_function`
0 commit comments