You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
## Improvements
14
14
15
15
- Added retries to verifying connection and authentication of DB connection provided to `GdsSessions.getOrCreate`
16
-
16
+
-`GdsSessions.get_or_create` now allows to specify the `aura_instance_id`. This is required if the instance id could not be derived from the provided database connection URI.
| db_connection | https://neo4j.com/docs/graph-data-science-client/{docs-version}/api/sessions/DbmsConnectionInfo[DbmsConnectionInfo] | yes | None | Bolt server URL, username, and password to a Neo4j DBMS. Required for the Attached and Self-managed types. Alternatively to username and password, you can provide a `neo4j.Auth` https://neo4j.com/docs/python-manual/current/connect-advanced/#authentication-methods[object].
101
102
| ttl | datetime.timedelta | yes | 1h | Time-to-live for the session.
102
103
| cloud_location | https://neo4j.com/docs/graph-data-science-client/{docs-version}/api/sessions/cloud_location[CloudLocation] | yes | None | Aura-supported cloud provider and region where the GDS Session will run. Required for the Self-managed and Standalone types.
104
+
| aura_instance_id | str | yes | None | Aura instance ID for the session. Required for the Attached type, if the id could not be derived from the DB connection.
103
105
| timeout | int | yes | None | Seconds to wait for the session to enter Ready state. If the time is exceeded, an error will be returned.
104
106
| neo4j_driver_options | dict[str, any] | yes | None | Additional options passed to the Neo4j driver to the Neo4j DBMS. Only relevant if `db_connection` is specified.
105
107
| arrow_client_options | dict[str, any] | yes | None | Additional options passed to the Arrow Flight Client used to connect to the Session.
raiseValueError("cloud_location must be provided for sessions against a self-managed DB.")
83
+
ifdb_connection.hosted_in_aura():
84
+
raiseValueError(
85
+
f"Could not derive Aura instance id from the URI `{db_connection.uri}`. Please provide the instance id via the `aura_instance_id` argument, or specify a cloud location if the DBMS is self-managed."
86
+
)
87
+
else:
88
+
raiseValueError("cloud_location must be provided for sessions against a self-managed DB.")
Copy file name to clipboardExpand all lines: graphdatascience/session/gds_sessions.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,7 @@ def get_or_create(
107
107
timeout: int|None=None,
108
108
neo4j_driver_config: dict[str, Any] |None=None,
109
109
arrow_client_options: dict[str, Any] |None=None,
110
+
aura_instance_id: str|None=None,
110
111
) ->AuraGraphDataScience:
111
112
"""
112
113
Retrieves an existing session with the given session name and database connection,
@@ -122,8 +123,9 @@ def get_or_create(
122
123
ttl: (timedelta | None): The sessions time to live after inactivity in seconds.
123
124
cloud_location (CloudLocation | None): The cloud location. Required if the GDS session is for a self-managed database.
124
125
timeout (int | None): Optional timeout (in seconds) when waiting for session to become ready. If unset the method will wait forever. If set and session does not become ready an exception will be raised. It is user responsibility to ensure resource gets cleaned up in this situation.
125
-
neo4j_driver_config (dict[str, Any] | None): Optional configuration for the Neo4j driver to the Neo4j DBMS. Only relevant if `db_connection` is specified..
126
+
neo4j_driver_config (dict[str, Any] | None): Optional configuration for the Neo4j driver to the Neo4j DBMS. Only relevant if `db_connection` is specified..
126
127
arrow_client_options (dict[str, Any] | None): Optional configuration for the Arrow Flight client.
128
+
aura_instance_id (str | None): The Aura instance id. Required if the database is in Aura but its instance id cannot be inferred from the connection information.
"Could not derive Aura instance id from the URI `neo4j+s://06cba79f.databases.neo4j.io`. Please provide the instance id via the `aura_instance_id` argument, or specify a cloud location if the DBMS is self-managed."
0 commit comments