Skip to content

Commit 5ec7fa0

Browse files
committed
Update notebook
1 parent 63eeb5a commit 5ec7fa0

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

examples/dev/gds-sessions.ipynb

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,21 @@
7070
"metadata": {},
7171
"outputs": [],
7272
"source": [
73-
"from graphdatascience.gds_session.dbms_connection_info import DbmsConnectionInfo\n",
73+
"from graphdatascience.gds_session import DbmsConnectionInfo\n",
7474
"import os\n",
7575
"\n",
7676
"from neo4j import GraphDatabase\n",
7777
"\n",
78-
"# We need to tell the GDS client that we are working with a development environment.\n",
79-
"# This does not need to be set in production.\n",
80-
"os.environ[\"AURA_ENV\"] = \"devstrawberryfield\"\n",
78+
"# We can tell the GDS client that we are working with a development environment.\n",
79+
"# os.environ[\"AURA_ENV\"] = \"devstrawberryfield\"\n",
8180
"\n",
82-
"db_connection_info = DbmsConnectionInfo(\n",
83-
" f\"neo4j+s://{db_id}-{os.environ['AURA_ENV']}.databases.neo4j-dev.io\", \"neo4j\", db_password\n",
81+
"uri = (\n",
82+
" f\"neo4j+s://{db_id}-{os.environ['AURA_ENV']}.databases.neo4j-dev.io\"\n",
83+
" if os.environ.get(\"AURA_ENV\")\n",
84+
" else f\"neo4j+s://{db_id}.databases.neo4j.io\"\n",
8485
")\n",
86+
"\n",
87+
"db_connection_info = DbmsConnectionInfo(uri, \"neo4j\", db_password)\n",
8588
"# start a standard Neo4j Python Driver to connect to the AuraDB instance\n",
8689
"driver = GraphDatabase.driver(db_connection_info.uri, auth=db_connection_info.auth())\n",
8790
"\n",
@@ -171,9 +174,11 @@
171174
"metadata": {},
172175
"outputs": [],
173176
"source": [
174-
"# Let's call this function and see what it returns\n",
177+
"# Let's call this function and verify the arrow server is enabled\n",
175178
"with driver.session() as session:\n",
176-
" display(session.run(\"CALL internal.arrow.status\").to_df())"
179+
" arrow_status = session.run(\"CALL internal.arrow.status\").to_df()\n",
180+
" print(arrow_status)\n",
181+
" assert arrow_status[\"enabled\"][0] == True, \"Arrow server on the db needs to be enabled\""
177182
]
178183
},
179184
{
@@ -244,7 +249,7 @@
244249
"outputs": [],
245250
"source": [
246251
"# The new stuff!\n",
247-
"from graphdatascience.gds_session.gds_sessions import GdsSessions, AuraAPICredentials\n",
252+
"from graphdatascience.gds_session import GdsSessions, AuraAPICredentials\n",
248253
"\n",
249254
"# Create a new AuraSessions object\n",
250255
"sessions = GdsSessions(ds_connection=AuraAPICredentials(CLIENT_ID, CLIENT_SECRET))"
@@ -311,6 +316,7 @@
311316
" session_name=\"pagerank-compute\",\n",
312317
" size=SessionSizes.by_memory().DEFAULT,\n",
313318
" db_connection=db_connection_info,\n",
319+
" region=\"europe-west1\",\n",
314320
")\n",
315321
"\n",
316322
"# If we had already created a session and want to reconnect to it, the same code is used.\n",
@@ -542,8 +548,22 @@
542548
}
543549
],
544550
"metadata": {
551+
"kernelspec": {
552+
"display_name": "Python 3",
553+
"language": "python",
554+
"name": "python3"
555+
},
545556
"language_info": {
546-
"name": "python"
557+
"codemirror_mode": {
558+
"name": "ipython",
559+
"version": 3
560+
},
561+
"file_extension": ".py",
562+
"mimetype": "text/x-python",
563+
"name": "python",
564+
"nbconvert_exporter": "python",
565+
"pygments_lexer": "ipython3",
566+
"version": "3.11.7"
547567
}
548568
},
549569
"nbformat": 4,

0 commit comments

Comments
 (0)