Skip to content

Commit be22acc

Browse files
authored
Merge pull request #153 from neo4j/fix-import-neo4j-example
Fix import for neo4j example
2 parents d42bf17 + 3821bef commit be22acc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/source/integration.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ In this small example, we import a graph from a Neo4j query result.
198198

199199
.. code-block:: python
200200
201-
from neo4j import GraphDataScience
201+
from neo4j import GraphDatabase, RoutingControl, Result
202202
from neo4j_viz.gds import from_gds
203203
204204
# Modify this to match your Neo4j instance's URI and credentials
@@ -211,6 +211,7 @@ In this small example, we import a graph from a Neo4j query result.
211211
result = driver.execute_query(
212212
"MATCH (n)-[r]->(m) RETURN n,r,m",
213213
database_="neo4j",
214+
routing_=RoutingControl.READ,
214215
result_transformer_=Result.graph,
215216
)
216217

examples/neo4j-example.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
"source": [
4545
"import os\n",
4646
"\n",
47-
"from neo4j import GraphDatabase, Result\n",
48-
"\n",
4947
"URI = os.environ.get(\"NEO4J_URI\", \"bolt://localhost:7687\")\n",
5048
"\n",
5149
"auth = None\n",
@@ -68,6 +66,8 @@
6866
"metadata": {},
6967
"outputs": [],
7068
"source": [
69+
"from neo4j import GraphDatabase\n",
70+
"\n",
7171
"with GraphDatabase.driver(URI, auth=auth) as driver:\n",
7272
" driver.verify_connectivity()\n",
7373
" driver.execute_query(\n",
@@ -130,12 +130,15 @@
130130
"metadata": {},
131131
"outputs": [],
132132
"source": [
133+
"from neo4j import Result, RoutingControl\n",
134+
"\n",
133135
"with GraphDatabase.driver(URI, auth=auth) as driver:\n",
134136
" driver.verify_connectivity()\n",
135137
"\n",
136138
" result = driver.execute_query(\n",
137139
" \"MATCH (n)-[r]->(m) RETURN n,r,m\",\n",
138140
" database_=\"neo4j\",\n",
141+
" routing_=RoutingControl.READ,\n",
139142
" result_transformer_=Result.graph,\n",
140143
" )\n",
141144
"\n",

0 commit comments

Comments
 (0)