Skip to content

Commit d7b42b4

Browse files
committed
Update docs
1 parent 9f8b46c commit d7b42b4

File tree

3 files changed

+58
-20
lines changed

3 files changed

+58
-20
lines changed

doc/modules/ROOT/pages/tutorials/graph-analytics-serverless-self-managed.adoc

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ version `1.15` or later.
3535

3636
[source, python, role=no-test]
3737
----
38-
%pip install "graphdatascience>=1.15"
38+
%pip install "graphdatascience>=1.15" python-dotenv
39+
----
40+
41+
[source, python, role=no-test]
42+
----
43+
from dotenv import load_dotenv
44+
45+
# This allows to load required secrets from `.env` file in local directory
46+
# This can include Aura API Credentials. If file does not exist this is a noop.
47+
load_dotenv(".env")
3948
----
4049

4150
== Aura API credentials
@@ -50,13 +59,15 @@ import os
5059
5160
from graphdatascience.session import AuraAPICredentials, GdsSessions
5261
53-
client_id = os.environ["AURA_API_CLIENT_ID"]
54-
client_secret = os.environ["AURA_API_CLIENT_SECRET"]
62+
# If your account is a member of several project, you must also specify the project ID to use
5563
56-
# If your account is a member of several projects, you must also specify the project ID to use
57-
project_id = os.environ.get("AURA_API_PROJECT_ID", None)
64+
api_credentials = AuraAPICredentials(
65+
client_id=os.environ["CLIENT_ID"],
66+
client_secret=os.environ["CLIENT_SECRET"],
67+
project_id=os.environ.get("PROJECT_ID", None),
68+
)
5869
59-
sessions = GdsSessions(api_credentials=AuraAPICredentials(client_id, client_secret, project_id=project_id))
70+
sessions = GdsSessions(api_credentials=api_credentials)
6071
----
6172

6273
== Creating a new session
@@ -110,7 +121,9 @@ from graphdatascience.session import DbmsConnectionInfo
110121
111122
# Identify the Neo4j DBMS
112123
db_connection = DbmsConnectionInfo(
113-
uri=os.environ["NEO4J_URI"], username=os.environ["NEO4J_USER"], password=os.environ["NEO4J_PASSWORD"]
124+
uri=os.environ["NEO4J_URI"],
125+
username=os.environ["NEO4J_USERNAME"],
126+
password=os.environ["NEO4J_PASSWORD"],
114127
)
115128
116129
# Create a GDS session!

doc/modules/ROOT/pages/tutorials/graph-analytics-serverless-standalone.adoc

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ version `1.15` or later.
3434

3535
[source, python, role=no-test]
3636
----
37-
%pip install "graphdatascience>=1.15"
37+
%pip install "graphdatascience>=1.15" python-dotenv
38+
----
39+
40+
[source, python, role=no-test]
41+
----
42+
from dotenv import load_dotenv
43+
44+
# This allows to load required secrets from `.env` file in local directory
45+
# This can include Aura API Credentials. If file does not exist this is a noop.
46+
load_dotenv(".env")
3847
----
3948

4049
== Aura API credentials
@@ -49,13 +58,15 @@ import os
4958
5059
from graphdatascience.session import AuraAPICredentials, GdsSessions
5160
52-
client_id = os.environ["AURA_API_CLIENT_ID"]
53-
client_secret = os.environ["AURA_API_CLIENT_SECRET"]
61+
# If your account is a member of several project, you must also specify the project ID to use
5462
55-
# If your account is a member of several projects, you must also specify the project ID to use
56-
project_id = os.environ.get("AURA_API_PROJECT_ID", None)
63+
api_credentials = AuraAPICredentials(
64+
client_id=os.environ["CLIENT_ID"],
65+
client_secret=os.environ["CLIENT_SECRET"],
66+
project_id=os.environ.get("PROJECT_ID", None),
67+
)
5768
58-
sessions = GdsSessions(api_credentials=AuraAPICredentials(client_id, client_secret, project_id=project_id))
69+
sessions = GdsSessions(api_credentials=api_credentials)
5970
----
6071

6172
== Creating a new session

doc/modules/ROOT/pages/tutorials/graph-analytics-serverless.adoc

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ version `1.15` or later.
3535

3636
[source, python, role=no-test]
3737
----
38-
%pip install "graphdatascience>=1.15"
38+
%pip install "graphdatascience>=1.15" python-dotenv
39+
----
40+
41+
[source, python, role=no-test]
42+
----
43+
from dotenv import load_dotenv
44+
45+
# This allows to load required secrets from `.env` file in local directory
46+
# This can include Aura API Credentials and Database Credentials.
47+
# If file does not exist this is a noop.
48+
load_dotenv(".env")
3949
----
4050

4151
== Aura API credentials
@@ -50,13 +60,15 @@ import os
5060
5161
from graphdatascience.session import AuraAPICredentials, GdsSessions
5262
53-
client_id = os.environ["AURA_API_CLIENT_ID"]
54-
client_secret = os.environ["AURA_API_CLIENT_SECRET"]
55-
5663
# If your account is a member of several project, you must also specify the project ID to use
57-
project_id = os.environ.get("AURA_API_PROJECT_ID", None)
5864
59-
sessions = GdsSessions(api_credentials=AuraAPICredentials(client_id, client_secret, project_id=project_id))
65+
api_credentials = AuraAPICredentials(
66+
client_id=os.environ["CLIENT_ID"],
67+
client_secret=os.environ["CLIENT_SECRET"],
68+
project_id=os.environ.get("PROJECT_ID", None),
69+
)
70+
71+
sessions = GdsSessions(api_credentials=api_credentials)
6072
----
6173

6274
== Creating a new session
@@ -100,7 +112,9 @@ from graphdatascience.session import DbmsConnectionInfo
100112
101113
# Identify the AuraDB instance
102114
db_connection = DbmsConnectionInfo(
103-
uri=os.environ["AURA_DB_ADDRESS"], username=os.environ["AURA_DB_USER"], password=os.environ["AURA_DB_PW"]
115+
uri=os.environ["NEO4J_URI"],
116+
username=os.environ["NEO4J_USERNAME"],
117+
password=os.environ["NEO4J_PASSWORD"],
104118
)
105119
106120
# Create a GDS session!

0 commit comments

Comments
 (0)