|
70 | 70 | "metadata": {}, |
71 | 71 | "outputs": [], |
72 | 72 | "source": [ |
73 | | - "from graphdatascience.gds_session.dbms_connection_info import DbmsConnectionInfo\n", |
| 73 | + "from graphdatascience.gds_session import DbmsConnectionInfo\n", |
74 | 74 | "import os\n", |
75 | 75 | "\n", |
76 | 76 | "from neo4j import GraphDatabase\n", |
77 | 77 | "\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", |
81 | 80 | "\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", |
84 | 85 | ")\n", |
| 86 | + "\n", |
| 87 | + "db_connection_info = DbmsConnectionInfo(uri, \"neo4j\", db_password)\n", |
85 | 88 | "# start a standard Neo4j Python Driver to connect to the AuraDB instance\n", |
86 | 89 | "driver = GraphDatabase.driver(db_connection_info.uri, auth=db_connection_info.auth())\n", |
87 | 90 | "\n", |
|
171 | 174 | "metadata": {}, |
172 | 175 | "outputs": [], |
173 | 176 | "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", |
175 | 178 | "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\"" |
177 | 182 | ] |
178 | 183 | }, |
179 | 184 | { |
|
244 | 249 | "outputs": [], |
245 | 250 | "source": [ |
246 | 251 | "# The new stuff!\n", |
247 | | - "from graphdatascience.gds_session.gds_sessions import GdsSessions, AuraAPICredentials\n", |
| 252 | + "from graphdatascience.gds_session import GdsSessions, AuraAPICredentials\n", |
248 | 253 | "\n", |
249 | 254 | "# Create a new AuraSessions object\n", |
250 | 255 | "sessions = GdsSessions(ds_connection=AuraAPICredentials(CLIENT_ID, CLIENT_SECRET))" |
|
311 | 316 | " session_name=\"pagerank-compute\",\n", |
312 | 317 | " size=SessionSizes.by_memory().DEFAULT,\n", |
313 | 318 | " db_connection=db_connection_info,\n", |
| 319 | + " region=\"europe-west1\",\n", |
314 | 320 | ")\n", |
315 | 321 | "\n", |
316 | 322 | "# If we had already created a session and want to reconnect to it, the same code is used.\n", |
|
542 | 548 | } |
543 | 549 | ], |
544 | 550 | "metadata": { |
| 551 | + "kernelspec": { |
| 552 | + "display_name": "Python 3", |
| 553 | + "language": "python", |
| 554 | + "name": "python3" |
| 555 | + }, |
545 | 556 | "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" |
547 | 567 | } |
548 | 568 | }, |
549 | 569 | "nbformat": 4, |
|
0 commit comments