Skip to content

Commit 8cbcd83

Browse files
authored
Fix bookmark manager docs (#793)
Results need to be consumed in order for the BMM to pick up the bookmarks. Note: Consumption could also happen through session closure, starting another auto- commit transaction, or maybe, in future protocol versions, will the server send bookmarks in the first `SUCCESS` message to an auto-commit `RUN`. But not yet.
1 parent ffad2a1 commit 8cbcd83

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

neo4j/_async/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ def bookmark_manager(
241241
async with driver.session(
242242
bookmark_manager=bookmark_manager
243243
) as session2:
244-
session1.run("<WRITE_QUERY>")
244+
result1 = await session1.run("<WRITE_QUERY>")
245+
await result1.consume()
245246
# READ_QUERY is guaranteed to see what WRITE_QUERY wrote.
246-
session2.run("<READ_QUERY>")
247+
result2 = await session2.run("<READ_QUERY>")
248+
await result2.consume()
247249
248250
This is a very contrived example, and in this particular case, having
249251
both queries in the same session has the exact same effect and might

neo4j/_sync/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,11 @@ def bookmark_manager(
240240
with driver.session(
241241
bookmark_manager=bookmark_manager
242242
) as session2:
243-
session1.run("<WRITE_QUERY>")
243+
result1 = session1.run("<WRITE_QUERY>")
244+
result1.consume()
244245
# READ_QUERY is guaranteed to see what WRITE_QUERY wrote.
245-
session2.run("<READ_QUERY>")
246+
result2 = session2.run("<READ_QUERY>")
247+
result2.consume()
246248
247249
This is a very contrived example, and in this particular case, having
248250
both queries in the same session has the exact same effect and might

0 commit comments

Comments
 (0)