Skip to content

Commit 8255fd1

Browse files
adamnschbrs96
andcommitted
Work around license check in the AuraDS case
Co-Authored-By: Brian Shi <[email protected]>
1 parent 98d3357 commit 8255fd1

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

changelog/1.2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
* Fixed a bug where the `separate_property_columns=True` option of `gds.graph.streamNodeProperties` did not handle list node properties correctly.
1313
* 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.
14+
* Fixed a bug where calling `gds.alpha.graph.construct` targeting an AuraDS instance would raise an exception.
1415

1516

1617
## Improvements

graphdatascience/query_runner/cypher_graph_constructor.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(
1919
self._graph_name = graph_name
2020

2121
def run(self, node_dfs: List[DataFrame], relationship_dfs: List[DataFrame]) -> None:
22-
if self._is_enterprise():
22+
if self._should_warn_about_arrow_missing():
2323
warnings.warn(
2424
"GDS Enterprise users can use Apache Arrow for fast graph construction; please see the documentation "
2525
"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
5555
},
5656
)
5757

58-
def _is_enterprise(self) -> bool:
59-
license: str = self._query_runner.run_query(
60-
"CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value"
61-
).squeeze()
62-
63-
return license == "Licensed"
58+
def _should_warn_about_arrow_missing(self) -> bool:
59+
try:
60+
license: str = self._query_runner.run_query(
61+
"CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value"
62+
).squeeze()
63+
should_warn = license == "Licensed"
64+
except Exception as e:
65+
# It's not a user's concern whether Arrow is set up or not in AuraDS.
66+
if (
67+
"There is no procedure with the name `gds.debug.sysInfo` "
68+
"registered for this database instance." in str(e)
69+
):
70+
should_warn = False
71+
else:
72+
raise e
73+
74+
return should_warn
6475

6576
def _node_query(self, node_df: DataFrame) -> Tuple[str, List[List[Any]]]:
6677
node_list = node_df.values.tolist()

graphdatascience/system/system_endpoints.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@ def debug(self) -> DebugProcRunner:
4242

4343
@client_only_endpoint("gds")
4444
def is_licensed(self) -> bool:
45-
license: str = self._query_runner.run_query(
46-
"CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value"
47-
).squeeze()
45+
try:
46+
license: str = self._query_runner.run_query(
47+
"CALL gds.debug.sysInfo() YIELD key, value WHERE key = 'gdsEdition' RETURN value"
48+
).squeeze()
49+
except Exception as e:
50+
# AuraDS does not have `gds.debug.sysInfo`, but is always GDS EE.
51+
if (
52+
"There is no procedure with the name `gds.debug.sysInfo` "
53+
"registered for this database instance." in str(e)
54+
):
55+
license = "Licensed"
56+
else:
57+
raise e
4858

4959
return license == "Licensed"

0 commit comments

Comments
 (0)