@@ -11,7 +11,7 @@ GraphDatabase
1111Driver Construction
1212===================
1313
14- The :class: `neo4j.Driver ` construction is via a `classmethod ` on the :class: `neo4j.GraphDatabase ` class.
14+ The :class: `neo4j.Driver ` construction is done via a `classmethod ` on the :class: `neo4j.GraphDatabase ` class.
1515
1616.. autoclass :: neo4j.GraphDatabase
1717 :members: driver
@@ -24,18 +24,19 @@ Example, driver creation:
2424 from neo4j import GraphDatabase
2525
2626 uri = " neo4j://example.com:7687"
27- driver = GraphDatabase.driver(uri, auth = (" neo4j" , " password" ), max_connection_lifetime = 1000 )
27+ driver = GraphDatabase.driver(uri, auth = (" neo4j" , " password" ))
2828
2929 driver.close() # close the driver object
3030
3131
32- For basic auth, this can be a simple tuple, for example:
32+ For basic authentication, ` auth ` can be a simple tuple, for example:
3333
3434.. code-block :: python
3535
3636 auth = (" neo4j" , " password" )
3737
38- This will implicitly create a :class: `neo4j.Auth ` with a ``scheme="basic" ``
38+ This will implicitly create a :class: `neo4j.Auth ` with a ``scheme="basic" ``.
39+ Other authentication methods are described under :ref: `auth-ref `.
3940
4041
4142Example, with block context:
@@ -345,11 +346,9 @@ BoltDriver
345346URI schemes:
346347 ``bolt ``, ``bolt+ssc ``, ``bolt+s ``
347348
348- Driver subclass:
349- :class: `neo4j.BoltDriver `
349+ Will result in:
350350
351- ..
352- .. autoclass:: neo4j.BoltDriver
351+ .. autoclass :: neo4j.BoltDriver
353352
354353
355354.. _neo4j-driver-ref :
@@ -360,11 +359,9 @@ Neo4jDriver
360359URI schemes:
361360 ``neo4j ``, ``neo4j+ssc ``, ``neo4j+s ``
362361
363- Driver subclass:
364- :class: `neo4j.Neo4jDriver `
362+ Will result in:
365363
366- ..
367- .. autoclass:: neo4j.Neo4jDriver
364+ .. autoclass :: neo4j.Neo4jDriver
368365
369366
370367***********************
@@ -604,7 +601,8 @@ Example:
604601
605602 def create_person (driver , name ):
606603 with driver.session(default_access_mode = neo4j.WRITE_ACCESS ) as session:
607- result = session.run(" CREATE (a:Person { name: $name }) RETURN id(a) AS node_id" , name = name)
604+ query = " CREATE (a:Person { name: $name }) RETURN id(a) AS node_id"
605+ result = session.run(query, name = name)
608606 record = result.single()
609607 return record[" node_id" ]
610608
@@ -665,13 +663,15 @@ Example:
665663 tx.close()
666664
667665 def create_person_node (tx ):
666+ query = " CREATE (a:Person { name: $name }) RETURN id(a) AS node_id"
668667 name = " default_name"
669- result = tx.run(" CREATE (a:Person { name: $name }) RETURN id(a) AS node_id " , name = name)
668+ result = tx.run(query , name = name)
670669 record = result.single()
671670 return record[" node_id" ]
672671
673672 def set_person_name (tx , node_id , name ):
674- result = tx.run(" MATCH (a:Person) WHERE id(a) = $id SET a.name = $name" , id = node_id, name = name)
673+ query = " MATCH (a:Person) WHERE id(a) = $id SET a.name = $name"
674+ result = tx.run(query, id = node_id, name = name)
675675 info = result.consume()
676676 # use the info for logging etc.
677677
@@ -698,7 +698,8 @@ Example:
698698 node_id = session.write_transaction(create_person_tx, name)
699699
700700 def create_person_tx (tx , name ):
701- result = tx.run(" CREATE (a:Person { name: $name }) RETURN id(a) AS node_id" , name = name)
701+ query = " CREATE (a:Person { name: $name }) RETURN id(a) AS node_id"
702+ result = tx.run(query, name = name)
702703 record = result.single()
703704 return record[" node_id" ]
704705
@@ -708,12 +709,6 @@ To exert more control over how a transaction function is carried out, the :func:
708709
709710
710711
711-
712-
713-
714-
715-
716-
717712******
718713Result
719714******
0 commit comments