Skip to content

Commit 863dd2a

Browse files
committed
Document gds::from_neo4j_driver
1 parent 3ccfe09 commit 863dd2a

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

graphdatascience/graph_data_science.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,51 @@ def from_neo4j_driver(
266266
driver: Driver,
267267
auth: Optional[tuple[str, str]] = None,
268268
database: Optional[str] = None,
269-
arrow: bool = True,
269+
arrow: Union[str, bool] = True,
270270
arrow_disable_server_verification: bool = True,
271271
arrow_tls_root_certs: Optional[bytes] = None,
272272
bookmarks: Optional[Any] = None,
273-
) -> "GraphDataScience":
273+
arrow_client_options: Optional[dict[str, Any]] = None,
274+
) -> GraphDataScience:
275+
"""
276+
Construct a new GraphDataScience object from an existing Neo4j Driver.
277+
This method is useful when you already have a Neo4j Driver instance and want to use it with the GDS client.
278+
279+
Parameters
280+
----------
281+
driver: Driver
282+
The Neo4j Driver instance to use.
283+
auth : Optional[Tuple[str, str]], default None
284+
A username, password pair for authentication.
285+
database: Optional[str], default None
286+
The Neo4j database to query against.
287+
arrow : Union[str, bool], default True
288+
Arrow connection information. This is either a string or a bool.
289+
290+
- If it is a string, it will be interpreted as a connection URL to a GDS Arrow Server.
291+
- If it is a bool:
292+
- True will make the client discover the connection URI to the GDS Arrow server via the Neo4j endpoint.
293+
- False will make the client use Bolt for all operations.
294+
arrow_disable_server_verification : bool, default True
295+
.. deprecated:: 1.16
296+
Use arrow_client_options instead
297+
298+
A flag that overrides other TLS settings and disables server verification for TLS connections.
299+
arrow_tls_root_certs : Optional[bytes], default None
300+
.. deprecated:: 1.16
301+
Use arrow_client_options instead
302+
303+
PEM-encoded certificates that are used for the connection to the
304+
GDS Arrow Flight server.
305+
bookmarks : Optional[Any], default None
306+
The Neo4j bookmarks to require a certain state before the next query gets executed.
307+
show_progress : bool, default True
308+
A flag to indicate whether to show progress bars for running procedures.
309+
arrow_client_options : Optional[dict[str, Any]], default None
310+
Additional options to be passed to the Arrow Flight client.
311+
Returns:
312+
A new GraphDataScience object. configured with the provided Neo4j Driver.
313+
"""
274314
return cls(
275315
driver,
276316
auth=auth,
@@ -279,6 +319,7 @@ def from_neo4j_driver(
279319
arrow_disable_server_verification=arrow_disable_server_verification,
280320
arrow_tls_root_certs=arrow_tls_root_certs,
281321
bookmarks=bookmarks,
322+
arrow_client_options=arrow_client_options,
282323
)
283324

284325
@staticmethod

0 commit comments

Comments
 (0)