diff --git a/changelog/1.2.0.md b/changelog/1.2.0.md index 274d88b41..effe15d39 100644 --- a/changelog/1.2.0.md +++ b/changelog/1.2.0.md @@ -10,6 +10,8 @@ ## Bug fixes * Fixed a bug where the `separate_property_columns=True` option of `gds.graph.streamNodeProperties` did not handle list node properties correctly. +* Fixed a bug where an irrelevant warning was shown when creating a `GraphDataScience` object targeting an AuraDS instance with GDS server version >= 2.1.0. +* Fixed a bug where calling `gds.alpha.graph.construct` targeting an AuraDS instance would raise an exception. ## Improvements diff --git a/graphdatascience/graph_data_science.py b/graphdatascience/graph_data_science.py index b9476bf62..078020620 100644 --- a/graphdatascience/graph_data_science.py +++ b/graphdatascience/graph_data_science.py @@ -80,7 +80,13 @@ def __init__( arrow_info["listenAddress"], self._query_runner, auth, driver.encrypted, True ) except Exception as e: - warnings.warn(f"Could not initialize GDS Flight Server client: {e}") + # AuraDS does not have arrow support at this time, so we should not warn about it. + # TODO: Remove this check when AuraDS gets arrow support. + if ( + "There is no procedure with the name `gds.debug.arrow` " + "registered for this database instance." not in str(e) + ): + warnings.warn(f"Could not initialize GDS Flight Server client: {e}") super().__init__(self._query_runner, "gds", self._server_version) diff --git a/graphdatascience/query_runner/cypher_graph_constructor.py b/graphdatascience/query_runner/cypher_graph_constructor.py index 64227fd3f..a2408dac2 100644 --- a/graphdatascience/query_runner/cypher_graph_constructor.py +++ b/graphdatascience/query_runner/cypher_graph_constructor.py @@ -19,7 +19,7 @@ def __init__( self._graph_name = graph_name def run(self, node_dfs: List[DataFrame], relationship_dfs: List[DataFrame]) -> None: - if self._is_enterprise(): + if self._should_warn_about_arrow_missing(): warnings.warn( "GDS Enterprise users can use Apache Arrow for fast graph construction; please see the documentation " "for instructions on how to enable it. Without Arrow enabled, this installation will use community " @@ -55,12 +55,23 @@ def run(self, node_dfs: List[DataFrame], relationship_dfs: List[DataFrame]) -> N }, ) - def _is_enterprise(self) -> bool: - license: str = self._query_runner.run_query( - "CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value" - ).squeeze() - - return license == "Licensed" + def _should_warn_about_arrow_missing(self) -> bool: + try: + license: str = self._query_runner.run_query( + "CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value" + ).squeeze() + should_warn = license == "Licensed" + except Exception as e: + # It's not a user's concern whether Arrow is set up or not in AuraDS. + if ( + "There is no procedure with the name `gds.debug.sysInfo` " + "registered for this database instance." in str(e) + ): + should_warn = False + else: + raise e + + return should_warn def _node_query(self, node_df: DataFrame) -> Tuple[str, List[List[Any]]]: node_list = node_df.values.tolist() diff --git a/graphdatascience/system/system_endpoints.py b/graphdatascience/system/system_endpoints.py index 5a2f74e17..5d40b286c 100644 --- a/graphdatascience/system/system_endpoints.py +++ b/graphdatascience/system/system_endpoints.py @@ -42,8 +42,18 @@ def debug(self) -> DebugProcRunner: @client_only_endpoint("gds") def is_licensed(self) -> bool: - license: str = self._query_runner.run_query( - "CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value" - ).squeeze() + try: + license: str = self._query_runner.run_query( + "CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value" + ).squeeze() + except Exception as e: + # AuraDS does not have `gds.debug.sysInfo`, but is always GDS EE. + if ( + "There is no procedure with the name `gds.debug.sysInfo` " + "registered for this database instance." in str(e) + ): + license = "Licensed" + else: + raise e return license == "Licensed"