graphdatascience 1.8__tar.gz → 1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. {graphdatascience-1.8/graphdatascience.egg-info → graphdatascience-1.10}/PKG-INFO +5 -2
  2. {graphdatascience-1.8 → graphdatascience-1.10}/README.md +1 -0
  3. graphdatascience-1.10/graphdatascience/__init__.py +36 -0
  4. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/algo/algo_proc_runner.py +3 -9
  5. graphdatascience-1.10/graphdatascience/call_parameters.py +8 -0
  6. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/caller_base.py +5 -1
  7. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/endpoints.py +1 -6
  8. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/endpoint_suggester.py +1 -1
  9. graphdatascience-1.8/graphdatascience/graph/graph_proc_runner.py → graphdatascience-1.10/graphdatascience/graph/base_graph_proc_runner.py +103 -86
  10. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_alpha_proc_runner.py +6 -8
  11. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_beta_proc_runner.py +8 -8
  12. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_create_result.py +4 -4
  13. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_cypher_runner.py +1 -1
  14. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_endpoints.py +0 -7
  15. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_entity_ops_runner.py +125 -82
  16. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_export_runner.py +5 -8
  17. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_object.py +16 -13
  18. graphdatascience-1.10/graphdatascience/graph/graph_proc_runner.py +15 -0
  19. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_project_runner.py +32 -25
  20. graphdatascience-1.10/graphdatascience/graph/graph_remote_proc_runner.py +9 -0
  21. graphdatascience-1.10/graphdatascience/graph/graph_remote_project_runner.py +38 -0
  22. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_sample_runner.py +19 -21
  23. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/ogb_loader.py +2 -2
  24. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph_data_science.py +43 -100
  25. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/graphsage_model.py +8 -5
  26. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/link_prediction_model.py +2 -2
  27. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/model.py +26 -16
  28. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/model_alpha_proc_runner.py +15 -20
  29. graphdatascience-1.10/graphdatascience/model/model_beta_proc_runner.py +31 -0
  30. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/model_proc_runner.py +23 -33
  31. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/node_classification_model.py +8 -5
  32. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/node_regression_model.py +2 -2
  33. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/simple_rel_embedding_model.py +44 -96
  34. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/classification_training_pipeline.py +17 -12
  35. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/lp_pipeline_create_runner.py +3 -3
  36. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/lp_training_pipeline.py +8 -9
  37. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/nc_pipeline_create_runner.py +3 -3
  38. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/nc_training_pipeline.py +6 -5
  39. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/nr_pipeline_create_runner.py +3 -3
  40. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/nr_training_pipeline.py +12 -11
  41. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/pipeline_proc_runner.py +10 -14
  42. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/training_pipeline.py +44 -38
  43. graphdatascience-1.10/graphdatascience/query_runner/arrow_endpoint_version.py +35 -0
  44. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/arrow_graph_constructor.py +25 -2
  45. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/arrow_query_runner.py +135 -27
  46. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/aura_db_arrow_query_runner.py +67 -41
  47. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/cypher_graph_constructor.py +3 -3
  48. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/neo4j_query_runner.py +133 -18
  49. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/query_runner.py +25 -5
  50. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/server_version/server_version.py +5 -6
  51. graphdatascience-1.10/graphdatascience/session/__init__.py +13 -0
  52. graphdatascience-1.10/graphdatascience/session/aura_api.py +300 -0
  53. graphdatascience-1.10/graphdatascience/session/aura_graph_data_science.py +181 -0
  54. graphdatascience-1.10/graphdatascience/session/dbms_connection_info.py +24 -0
  55. graphdatascience-1.10/graphdatascience/session/gds_sessions.py +238 -0
  56. graphdatascience-1.10/graphdatascience/session/region_suggester.py +17 -0
  57. graphdatascience-1.10/graphdatascience/session/schema.py +13 -0
  58. graphdatascience-1.10/graphdatascience/session/session_sizes.py +33 -0
  59. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/system/config_endpoints.py +5 -8
  60. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/system/system_endpoints.py +24 -38
  61. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/topological_lp/topological_lp_alpha_runner.py +2 -2
  62. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/utils/util_endpoints.py +11 -13
  63. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/utils/util_proc_runner.py +6 -6
  64. graphdatascience-1.10/graphdatascience/version.py +1 -0
  65. {graphdatascience-1.8 → graphdatascience-1.10/graphdatascience.egg-info}/PKG-INFO +5 -2
  66. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience.egg-info/SOURCES.txt +13 -1
  67. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience.egg-info/requires.txt +2 -1
  68. {graphdatascience-1.8 → graphdatascience-1.10}/requirements/base/base.txt +2 -1
  69. {graphdatascience-1.8 → graphdatascience-1.10}/setup.py +1 -0
  70. graphdatascience-1.8/graphdatascience/__init__.py +0 -5
  71. graphdatascience-1.8/graphdatascience/graph/graph_alpha_project_runner.py +0 -17
  72. graphdatascience-1.8/graphdatascience/model/model_beta_proc_runner.py +0 -37
  73. graphdatascience-1.8/graphdatascience/version.py +0 -1
  74. {graphdatascience-1.8 → graphdatascience-1.10}/LICENSE +0 -0
  75. {graphdatascience-1.8 → graphdatascience-1.10}/MANIFEST.in +0 -0
  76. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/algo/__init__.py +0 -0
  77. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/algo/algo_endpoints.py +0 -0
  78. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/algo/single_mode_algo_endpoints.py +0 -0
  79. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/call_builder.py +0 -0
  80. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/__init__.py +0 -0
  81. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/client_only_endpoint.py +0 -0
  82. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/cypher_warning_handler.py +0 -0
  83. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/gds_not_installed.py +0 -0
  84. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/illegal_attr_checker.py +0 -0
  85. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/unable_to_connect.py +0 -0
  86. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/error/uncallable_namespace.py +0 -0
  87. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/__init__.py +0 -0
  88. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/graph_type_check.py +0 -0
  89. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/graph/nx_loader.py +0 -0
  90. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/ignored_server_endpoints.py +0 -0
  91. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/__init__.py +0 -0
  92. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/model_endpoints.py +0 -0
  93. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/model_resolver.py +0 -0
  94. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/model/pipeline_model.py +0 -0
  95. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/__init__.py +0 -0
  96. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -0
  97. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -0
  98. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/pipeline/pipeline_endpoints.py +0 -0
  99. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/py.typed +0 -0
  100. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/__init__.py +0 -0
  101. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/query_runner/graph_constructor.py +0 -0
  102. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/__init__.py +0 -0
  103. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/cora/__init__.py +0 -0
  104. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/cora/cora_nodes.parquet.gzip +0 -0
  105. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/cora/cora_rels.parquet.gzip +0 -0
  106. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/cora/serialize_cora.py +0 -0
  107. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/__init__.py +0 -0
  108. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_acted_in.parquet.gzip +0 -0
  109. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_actors.parquet.gzip +0 -0
  110. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_directed_in.parquet.gzip +0 -0
  111. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_directors.parquet.gzip +0 -0
  112. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_movies_with_genre.parquet.gzip +0 -0
  113. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/imdb_movies_without_genre.parquet.gzip +0 -0
  114. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/imdb/serialize_imdb.py +0 -0
  115. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/karate/__init__.py +0 -0
  116. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/karate/karate_club.parquet.gzip +0 -0
  117. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/__init__.py +0 -0
  118. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/artist_nodes.parquet.gzip +0 -0
  119. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/serialize_lastfm.py +0 -0
  120. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/user_friend_df_directed.parquet.gzip +0 -0
  121. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/user_listen_artist_rels.parquet.gzip +0 -0
  122. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/user_nodes.parquet.gzip +0 -0
  123. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/resources/lastfm/user_tag_artist_rels.parquet.gzip +0 -0
  124. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/server_version/__init__.py +0 -0
  125. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/server_version/compatible_with.py +0 -0
  126. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/system/__init__.py +0 -0
  127. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/topological_lp/__init__.py +0 -0
  128. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/topological_lp/topological_lp_endpoints.py +0 -0
  129. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience/utils/__init__.py +0 -0
  130. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience.egg-info/dependency_links.txt +0 -0
  131. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience.egg-info/not-zip-safe +0 -0
  132. {graphdatascience-1.8 → graphdatascience-1.10}/graphdatascience.egg-info/top_level.txt +0 -0
  133. {graphdatascience-1.8 → graphdatascience-1.10}/pyproject.toml +0 -0
  134. {graphdatascience-1.8 → graphdatascience-1.10}/requirements/base/networkx.txt +0 -0
  135. {graphdatascience-1.8 → graphdatascience-1.10}/requirements/base/ogb.txt +0 -0
  136. {graphdatascience-1.8 → graphdatascience-1.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: graphdatascience
3
- Version: 1.8
3
+ Version: 1.10
4
4
  Summary: A Python client for the Neo4j Graph Data Science (GDS) library
5
5
  Home-page: https://neo4j.com/product/graph-data-science/
6
6
  Author: Neo4j
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.8
20
20
  Classifier: Programming Language :: Python :: 3.9
21
21
  Classifier: Programming Language :: Python :: 3.10
22
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
23
24
  Classifier: Topic :: Database
24
25
  Classifier: Topic :: Scientific/Engineering
25
26
  Classifier: Topic :: Software Development
@@ -30,10 +31,11 @@ License-File: LICENSE
30
31
  Requires-Dist: multimethod<2.0,>=1.0
31
32
  Requires-Dist: neo4j<6.0,>=4.4.2
32
33
  Requires-Dist: pandas<3.0,>=1.0
33
- Requires-Dist: pyarrow<14.0,>=4.0
34
+ Requires-Dist: pyarrow<16.0,>=11.0
34
35
  Requires-Dist: textdistance<5.0,>=4.0
35
36
  Requires-Dist: tqdm<5.0,>=4.0
36
37
  Requires-Dist: typing-extensions<5.0,>=4.0
38
+ Requires-Dist: requests
37
39
  Provides-Extra: ogb
38
40
  Requires-Dist: ogb<2.0,>=1.0; extra == "ogb"
39
41
  Provides-Extra: networkx
@@ -125,6 +127,7 @@ Full end-to-end examples in Jupyter ready-to-run notebooks can be found in the [
125
127
  * [Sampling, Export and Integration with PyG example](examples/import-sample-export-gnn.ipynb)
126
128
  * [Load data to a projected graph via graph construction](examples/load-data-via-graph-construction.ipynb)
127
129
  * [Heterogeneous Node Classification with HashGNN and Autotuning](https://github.com/neo4j/graph-data-science-client/tree/main/examples/heterogeneous-node-classification-with-hashgnn.ipynb)
130
+ * [Perform inference using pre-trained KGE models](examples/kge-predict-transe-pyg-train.ipynb)
128
131
 
129
132
 
130
133
  ## Documentation
@@ -84,6 +84,7 @@ Full end-to-end examples in Jupyter ready-to-run notebooks can be found in the [
84
84
  * [Sampling, Export and Integration with PyG example](examples/import-sample-export-gnn.ipynb)
85
85
  * [Load data to a projected graph via graph construction](examples/load-data-via-graph-construction.ipynb)
86
86
  * [Heterogeneous Node Classification with HashGNN and Autotuning](https://github.com/neo4j/graph-data-science-client/tree/main/examples/heterogeneous-node-classification-with-hashgnn.ipynb)
87
+ * [Perform inference using pre-trained KGE models](examples/kge-predict-transe-pyg-train.ipynb)
87
88
 
88
89
 
89
90
  ## Documentation
@@ -0,0 +1,36 @@
1
+ from .graph.graph_create_result import GraphCreateResult
2
+ from .graph.graph_object import Graph
3
+ from .graph_data_science import GraphDataScience
4
+ from .model.graphsage_model import GraphSageModel
5
+ from .model.link_prediction_model import LinkFeature, LPModel
6
+ from .model.node_classification_model import NCModel
7
+ from .model.node_regression_model import NRModel
8
+ from .model.pipeline_model import NodePropertyStep
9
+ from .model.simple_rel_embedding_model import SimpleRelEmbeddingModel
10
+ from .pipeline.lp_training_pipeline import LPTrainingPipeline
11
+ from .pipeline.nc_training_pipeline import NCTrainingPipeline
12
+ from .pipeline.nr_training_pipeline import NRTrainingPipeline
13
+ from .query_runner.query_runner import QueryRunner
14
+ from .server_version.server_version import ServerVersion
15
+ from .session.gds_sessions import GdsSessions
16
+ from .version import __version__
17
+
18
+ __all__ = [
19
+ "GraphDataScience",
20
+ "GdsSessions",
21
+ "QueryRunner",
22
+ "__version__",
23
+ "ServerVersion",
24
+ "Graph",
25
+ "GraphCreateResult",
26
+ "LPTrainingPipeline",
27
+ "NCTrainingPipeline",
28
+ "NRTrainingPipeline",
29
+ "NodePropertyStep",
30
+ "LinkFeature",
31
+ "LPModel",
32
+ "NCModel",
33
+ "NRModel",
34
+ "GraphSageModel",
35
+ "SimpleRelEmbeddingModel",
36
+ ]
@@ -7,21 +7,15 @@ from ..error.illegal_attr_checker import IllegalAttrChecker
7
7
  from ..graph.graph_object import Graph
8
8
  from ..graph.graph_type_check import graph_type_check
9
9
  from ..model.graphsage_model import GraphSageModel
10
+ from graphdatascience.call_parameters import CallParameters
10
11
 
11
12
 
12
13
  class AlgoProcRunner(IllegalAttrChecker, ABC):
13
14
  @graph_type_check
14
15
  def _run_procedure(self, G: Graph, config: Dict[str, Any], with_logging: bool = True) -> DataFrame:
15
- query = f"CALL {self._namespace}($graph_name, $config)"
16
+ params = CallParameters(graph_name=G.name(), config=config)
16
17
 
17
- params: Dict[str, Any] = {}
18
- params["graph_name"] = G.name()
19
- params["config"] = config
20
-
21
- if with_logging:
22
- return self._query_runner.run_query_with_logging(query, params)
23
- else:
24
- return self._query_runner.run_query(query, params)
18
+ return self._query_runner.call_procedure(endpoint=self._namespace, params=params, logging=with_logging)
25
19
 
26
20
  @graph_type_check
27
21
  def estimate(self, G: Graph, **config: Any) -> "Series[Any]":
@@ -0,0 +1,8 @@
1
+ from typing import Any, OrderedDict
2
+
3
+
4
+ class CallParameters(OrderedDict[str, Any]):
5
+ # since Python 3.6 also initializing through CallParameters(**kwargs) is order preserving
6
+
7
+ def placeholder_str(self) -> str:
8
+ return ", ".join([f"${k}" for k in self.keys()])
@@ -13,7 +13,11 @@ class CallerBase(ABC):
13
13
  self._server_version = server_version
14
14
 
15
15
  def _raise_suggestive_error_message(self, requested_endpoint: str) -> NoReturn:
16
- list_result = self._query_runner.run_query("CALL gds.list() YIELD name", custom_error=False)
16
+ list_result = self._query_runner.call_procedure(
17
+ endpoint="gds.list",
18
+ yields=["name"],
19
+ custom_error=False,
20
+ )
17
21
  all_endpoints = list_result["name"].tolist()
18
22
 
19
23
  raise SyntaxError(generate_suggestive_error_message(requested_endpoint, all_endpoints))
@@ -3,11 +3,7 @@ from .algo.single_mode_algo_endpoints import (
3
3
  SingleModeAlphaAlgoEndpoints,
4
4
  )
5
5
  from .call_builder import IndirectAlphaCallBuilder, IndirectBetaCallBuilder
6
- from .graph.graph_endpoints import (
7
- GraphAlphaEndpoints,
8
- GraphBetaEndpoints,
9
- GraphEndpoints,
10
- )
6
+ from .graph.graph_endpoints import GraphAlphaEndpoints, GraphBetaEndpoints
11
7
  from .model.model_endpoints import (
12
8
  ModelAlphaEndpoints,
13
9
  ModelBetaEndpoints,
@@ -39,7 +35,6 @@ class DirectEndpoints(
39
35
  SingleModeAlgoEndpoints,
40
36
  DirectSystemEndpoints,
41
37
  DirectUtilEndpoints,
42
- GraphEndpoints,
43
38
  PipelineEndpoints,
44
39
  ModelEndpoints,
45
40
  ConfigEndpoints,
@@ -9,7 +9,7 @@ def generate_suggestive_error_message(requested_endpoint: str, all_endpoints: Li
9
9
  MIN_SIMILARITY_FOR_SUGGESTION = 0.9
10
10
 
11
11
  closest_endpoint = None
12
- curr_max_similarity = 0
12
+ curr_max_similarity = 0.0
13
13
  for ep in all_endpoints:
14
14
  similarity = textdistance.jaro_winkler(requested_endpoint, ep)
15
15
  if similarity >= MIN_SIMILARITY_FOR_SUGGESTION:
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import pathlib
3
3
  import sys
4
+ import warnings
4
5
  from typing import Any, Dict, List, Optional, Union
5
6
 
6
7
  import pandas as pd
@@ -17,6 +18,7 @@ from .graph_entity_ops_runner import (
17
18
  GraphElementPropertyRunner,
18
19
  GraphLabelRunner,
19
20
  GraphNodePropertiesRunner,
21
+ GraphNodePropertyRunner,
20
22
  GraphPropertyRunner,
21
23
  GraphRelationshipPropertiesRunner,
22
24
  GraphRelationshipRunner,
@@ -24,7 +26,6 @@ from .graph_entity_ops_runner import (
24
26
  )
25
27
  from .graph_export_runner import GraphExportRunner
26
28
  from .graph_object import Graph
27
- from .graph_project_runner import GraphProjectRunner
28
29
  from .graph_sample_runner import GraphSampleRunner
29
30
  from .graph_type_check import (
30
31
  from_graph_type_check,
@@ -32,15 +33,24 @@ from .graph_type_check import (
32
33
  graph_type_check_optional,
33
34
  )
34
35
  from .ogb_loader import OGBLLoader, OGBNLoader
36
+ from graphdatascience.call_parameters import CallParameters
35
37
  from graphdatascience.graph.graph_create_result import GraphCreateResult
36
- from graphdatascience.graph.graph_cypher_runner import GraphCypherRunner
37
38
 
38
39
  Strings = Union[str, List[str]]
39
40
 
40
41
  is_neo4j_4_driver = ServerVersion.from_string(neo4j_driver_version) < ServerVersion(5, 0, 0)
41
42
 
42
43
 
43
- class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
44
+ class BaseGraphProcRunner(UncallableNamespace, IllegalAttrChecker):
45
+ def __init__(self, query_runner: Any, namespace: str, server_version: ServerVersion):
46
+ super().__init__(query_runner, namespace, server_version)
47
+ # Pandas 2.2.0 deprecated an API used by ArrowTable.to_pandas() (< pyarrow 14.0)
48
+ warnings.filterwarnings(
49
+ "ignore",
50
+ category=DeprecationWarning,
51
+ message=r"Passing a BlockManager to DataFrame is deprecated",
52
+ )
53
+
44
54
  @staticmethod
45
55
  def _path(package: str, resource: str) -> pathlib.Path:
46
56
  if sys.version_info >= (3, 9):
@@ -77,8 +87,11 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
77
87
 
78
88
  errors = []
79
89
 
80
- exists = self._query_runner.run_query(
81
- f"CALL gds.graph.exists('{graph_name}') YIELD exists", custom_error=False
90
+ exists = self._query_runner.call_procedure(
91
+ endpoint="gds.graph.exists",
92
+ params=CallParameters(graph_name=graph_name),
93
+ yields=["exists"],
94
+ custom_error=False,
82
95
  ).squeeze()
83
96
 
84
97
  # compare against True as (1) unit tests return None here and (2) numpys True does not work with `is True`.
@@ -213,11 +226,6 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
213
226
  self._namespace += ".networkx"
214
227
  return NXLoader(self._query_runner, self._namespace, self._server_version)
215
228
 
216
- @property
217
- def project(self) -> GraphProjectRunner:
218
- self._namespace += ".project"
219
- return GraphProjectRunner(self._query_runner, self._namespace, self._server_version)
220
-
221
229
  @property
222
230
  @compatible_with("graphProperty", min_inclusive=ServerVersion(2, 5, 0))
223
231
  def graphProperty(self) -> GraphPropertyRunner:
@@ -230,24 +238,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
230
238
  self._namespace += ".nodeLabel"
231
239
  return GraphLabelRunner(self._query_runner, self._namespace, self._server_version)
232
240
 
233
- @property
234
- def cypher(self) -> GraphCypherRunner:
235
- self._namespace += ".project"
236
- return GraphCypherRunner(self._query_runner, self._namespace, self._server_version)
237
-
238
241
  @compatible_with("generate", min_inclusive=ServerVersion(2, 5, 0))
239
242
  def generate(self, graph_name: str, node_count: int, average_degree: int, **config: Any) -> GraphCreateResult:
240
243
  self._namespace += ".generate"
244
+ params = CallParameters(
245
+ graph_name=graph_name, node_count=node_count, average_degree=average_degree, config=config
246
+ )
241
247
 
242
- query = f"CALL {self._namespace}($graph_name, $node_count, $average_degree, $config)"
243
- params = {
244
- "graph_name": graph_name,
245
- "node_count": node_count,
246
- "average_degree": average_degree,
247
- "config": config,
248
- }
249
-
250
- result = self._query_runner.run_query(query, params).squeeze()
248
+ result = self._query_runner.call_procedure(
249
+ endpoint=self._namespace,
250
+ params=params,
251
+ ).squeeze()
251
252
 
252
253
  return GraphCreateResult(Graph(graph_name, self._query_runner, self._server_version), result)
253
254
 
@@ -262,15 +263,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
262
263
  **config: Any,
263
264
  ) -> GraphCreateResult:
264
265
  self._namespace += ".filter"
265
- result = self._query_runner.run_query_with_logging(
266
- f"CALL {self._namespace}($graph_name, $from_graph_name, $node_filter, $relationship_filter, $config)",
267
- {
268
- "graph_name": graph_name,
269
- "from_graph_name": from_G.name(),
270
- "node_filter": node_filter,
271
- "relationship_filter": relationship_filter,
272
- "config": config,
273
- },
266
+ params = CallParameters(
267
+ graph_name=graph_name,
268
+ from_graph_name=from_G.name(),
269
+ node_filter=node_filter,
270
+ relationship_filter=relationship_filter,
271
+ config=config,
272
+ )
273
+ result = self._query_runner.call_procedure(
274
+ endpoint=self._namespace,
275
+ logging=True,
276
+ params=params,
274
277
  ).squeeze()
275
278
 
276
279
  return GraphCreateResult(Graph(graph_name, self._query_runner, self._server_version), result)
@@ -290,28 +293,30 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
290
293
  self._namespace += ".ogbl"
291
294
  return OGBLLoader(self._query_runner, self._namespace, self._server_version)
292
295
 
293
- @graph_type_check
294
296
  def drop(
295
297
  self,
296
- G: Graph,
298
+ graph: Union[Graph, str],
297
299
  failIfMissing: bool = False,
298
300
  dbName: str = "",
299
301
  username: Optional[str] = None,
300
302
  ) -> Optional["Series[Any]"]:
301
303
  self._namespace += ".drop"
302
304
 
303
- params = {
304
- "graph_name": G.name(),
305
- "fail_if_missing": failIfMissing,
306
- "db_name": dbName,
307
- }
305
+ if isinstance(graph, Graph):
306
+ graph = graph.name()
307
+
308
+ params = CallParameters(
309
+ graph_name=graph,
310
+ fail_if_missing=failIfMissing,
311
+ db_name=dbName,
312
+ )
308
313
  if username:
309
- query = f"CALL {self._namespace}($graph_name, $fail_if_missing, $db_name, $username)"
310
314
  params["username"] = username
311
- else:
312
- query = f"CALL {self._namespace}($graph_name, $fail_if_missing, $db_name)"
313
315
 
314
- result = self._query_runner.run_query(query, params)
316
+ result = self._query_runner.call_procedure(
317
+ endpoint=self._namespace,
318
+ params=params,
319
+ )
315
320
  if not result.empty:
316
321
  return result.squeeze() # type: ignore
317
322
 
@@ -319,7 +324,10 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
319
324
 
320
325
  def exists(self, graph_name: str) -> "Series[Any]":
321
326
  self._namespace += ".exists"
322
- result = self._query_runner.run_query(f"CALL {self._namespace}($graph_name)", {"graph_name": graph_name})
327
+ result = self._query_runner.call_procedure(
328
+ endpoint=self._namespace,
329
+ params=CallParameters(graph_name=graph_name),
330
+ )
323
331
 
324
332
  return result.squeeze() # type: ignore
325
333
 
@@ -327,19 +335,22 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
327
335
  def list(self, G: Optional[Graph] = None) -> DataFrame:
328
336
  self._namespace += ".list"
329
337
 
338
+ params = CallParameters()
330
339
  if G:
331
- query = f"CALL {self._namespace}($graph_name)"
332
- params = {"graph_name": G.name()}
333
- else:
334
- query = "CALL gds.graph.list()"
335
- params = {}
340
+ params["graph_name"] = G.name()
336
341
 
337
- return self._query_runner.run_query(query, params)
342
+ return self._query_runner.call_procedure(
343
+ endpoint=self._namespace,
344
+ params=params,
345
+ )
338
346
 
339
347
  @client_only_endpoint("gds.graph")
340
348
  def get(self, graph_name: str) -> Graph:
341
- result = self._query_runner.run_query(
342
- f"CALL gds.graph.list('{graph_name}') YIELD graphName", custom_error=False
349
+ result = self._query_runner.call_procedure(
350
+ endpoint="gds.graph.list",
351
+ params=CallParameters(graph_name=graph_name),
352
+ yields=["graphName"],
353
+ custom_error=False,
343
354
  )
344
355
  if len(result["graphName"]) == 0:
345
356
  raise ValueError(
@@ -356,20 +367,22 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
356
367
  entities: Strings,
357
368
  config: Dict[str, Any],
358
369
  ) -> DataFrame:
359
- query = f"CALL {self._namespace}($graph_name, $properties, $entities, $config)"
360
- params = {
361
- "graph_name": G.name(),
362
- "properties": properties,
363
- "entities": entities,
364
- "config": config,
365
- }
370
+ params = CallParameters(
371
+ graph_name=G.name(),
372
+ properties=properties,
373
+ entities=entities,
374
+ config=config,
375
+ )
366
376
 
367
- return self._query_runner.run_query(query, params)
377
+ return self._query_runner.call_procedure(
378
+ endpoint=self._namespace,
379
+ params=params,
380
+ )
368
381
 
369
382
  @property
370
- def nodeProperty(self) -> GraphElementPropertyRunner:
383
+ def nodeProperty(self) -> GraphNodePropertyRunner:
371
384
  self._namespace += ".nodeProperty"
372
- return GraphElementPropertyRunner(self._query_runner, self._namespace, self._server_version)
385
+ return GraphNodePropertyRunner(self._query_runner, self._namespace, self._server_version)
373
386
 
374
387
  @property
375
388
  def nodeProperties(self) -> GraphNodePropertiesRunner:
@@ -491,16 +504,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
491
504
  **config: Any,
492
505
  ) -> "Series[Any]":
493
506
  self._namespace += ".writeRelationship"
507
+ params = CallParameters(
508
+ graph_name=G.name(),
509
+ relationship_type=relationship_type,
510
+ relationship_property=relationship_property,
511
+ config=config,
512
+ )
494
513
 
495
- query = f"CALL {self._namespace}($graph_name, $relationship_type, $relationship_property, $config)"
496
- params = {
497
- "graph_name": G.name(),
498
- "relationship_type": relationship_type,
499
- "relationship_property": relationship_property,
500
- "config": config,
501
- }
502
-
503
- return self._query_runner.run_query(query, params).squeeze() # type: ignore
514
+ return self._query_runner.call_procedure( # type: ignore
515
+ endpoint=self._namespace,
516
+ params=params,
517
+ ).squeeze()
504
518
 
505
519
  @multimethod
506
520
  def removeNodeProperties(self) -> None:
@@ -515,15 +529,16 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
515
529
  **config: Any,
516
530
  ) -> Series: # type: ignore
517
531
  self._namespace += ".removeNodeProperties"
532
+ params = CallParameters(
533
+ graph_name=G.name(),
534
+ properties=node_properties,
535
+ config=config,
536
+ )
518
537
 
519
- query = f"CALL {self._namespace}($graph_name, $properties, $config)"
520
- params = {
521
- "graph_name": G.name(),
522
- "properties": node_properties,
523
- "config": config,
524
- }
525
-
526
- return self._query_runner.run_query(query, params).squeeze() # type: ignore
538
+ return self._query_runner.call_procedure( # type: ignore
539
+ endpoint=self._namespace,
540
+ params=params,
541
+ ).squeeze()
527
542
 
528
543
  @removeNodeProperties.register
529
544
  @compatible_with("removeNodeProperties", max_exclusive=ServerVersion(2, 1, 0))
@@ -543,10 +558,12 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
543
558
  def deleteRelationships(self, G: Graph, relationship_type: str) -> "Series[Any]":
544
559
  self._namespace += ".deleteRelationships"
545
560
 
546
- query = f"CALL {self._namespace}($graph_name, $relationship_type)"
547
- params = {
548
- "graph_name": G.name(),
549
- "relationship_type": relationship_type,
550
- }
561
+ params = CallParameters(
562
+ graph_name=G.name(),
563
+ relationship_type=relationship_type,
564
+ )
551
565
 
552
- return self._query_runner.run_query(query, params).squeeze() # type: ignore
566
+ return self._query_runner.call_procedure( # type: ignore
567
+ endpoint=self._namespace,
568
+ params=params,
569
+ ).squeeze()
@@ -3,12 +3,12 @@ from typing import List, Optional, Union
3
3
 
4
4
  from pandas import DataFrame
5
5
 
6
+ from ..call_parameters import CallParameters
6
7
  from ..error.client_only_endpoint import client_deprecated, client_only_endpoint
7
8
  from ..error.illegal_attr_checker import IllegalAttrChecker
8
9
  from ..error.uncallable_namespace import UncallableNamespace
9
10
  from ..server_version.compatible_with import compatible_with
10
11
  from ..server_version.server_version import ServerVersion
11
- from .graph_alpha_project_runner import GraphAlphaProjectRunner
12
12
  from .graph_entity_ops_runner import GraphLabelRunner, GraphPropertyRunner
13
13
  from .graph_object import Graph
14
14
  from .graph_sample_runner import GraphAlphaSampleRunner
@@ -30,11 +30,6 @@ class GraphAlphaProcRunner(UncallableNamespace, IllegalAttrChecker):
30
30
  self._namespace += ".nodeLabel"
31
31
  return GraphLabelRunner(self._query_runner, self._namespace, self._server_version)
32
32
 
33
- @property
34
- def project(self) -> GraphAlphaProjectRunner:
35
- self._namespace += ".project"
36
- return GraphAlphaProjectRunner(self._query_runner, self._namespace, self._server_version)
37
-
38
33
  @client_only_endpoint("gds.alpha.graph")
39
34
  @client_deprecated(old_endpoint="gds.alpha.graph.construct", new_endpoint="gds.graph.construct")
40
35
  @compatible_with("construct", min_inclusive=ServerVersion(2, 1, 0))
@@ -51,8 +46,11 @@ class GraphAlphaProcRunner(UncallableNamespace, IllegalAttrChecker):
51
46
 
52
47
  errors = []
53
48
 
54
- exists = self._query_runner.run_query(
55
- f"CALL gds.graph.exists('{graph_name}') YIELD exists", custom_error=False
49
+ exists = self._query_runner.call_procedure(
50
+ endpoint="gds.graph.exists",
51
+ yields=["exists"],
52
+ params=CallParameters(graph_name=graph_name),
53
+ custom_error=False,
56
54
  ).squeeze()
57
55
 
58
56
  # compare against True as (1) unit tests return None here and (2) numpys True does not work with `is True`.
@@ -5,6 +5,7 @@ from ..error.uncallable_namespace import UncallableNamespace
5
5
  from .graph_export_runner import GraphExportCsvEndpoints
6
6
  from .graph_object import Graph
7
7
  from .graph_project_runner import GraphProjectBetaRunner
8
+ from graphdatascience.call_parameters import CallParameters
8
9
  from graphdatascience.graph.graph_create_result import GraphCreateResult
9
10
  from graphdatascience.graph.graph_entity_ops_runner import GraphRelationshipsBetaRunner
10
11
 
@@ -30,14 +31,13 @@ class GraphBetaProcRunner(UncallableNamespace, IllegalAttrChecker):
30
31
  def generate(self, graph_name: str, node_count: int, average_degree: int, **config: Any) -> GraphCreateResult:
31
32
  self._namespace += ".generate"
32
33
 
33
- query = f"CALL {self._namespace}($graph_name, $node_count, $average_degree, $config)"
34
- params = {
35
- "graph_name": graph_name,
36
- "node_count": node_count,
37
- "average_degree": average_degree,
38
- "config": config,
39
- }
34
+ params = CallParameters(
35
+ graph_name=graph_name,
36
+ node_count=node_count,
37
+ average_degree=average_degree,
38
+ config=config,
39
+ )
40
40
 
41
- result = self._query_runner.run_query(query, params).squeeze()
41
+ result = self._query_runner.call_procedure(endpoint=self._namespace, params=params).squeeze()
42
42
 
43
43
  return GraphCreateResult(Graph(graph_name, self._query_runner, self._server_version), result)
@@ -1,12 +1,12 @@
1
+ from __future__ import annotations
2
+
1
3
  from types import TracebackType
2
- from typing import Any, NamedTuple, Optional, Type, TypeVar
4
+ from typing import Any, NamedTuple, Optional, Type
3
5
 
4
6
  from pandas import Series
5
7
 
6
8
  from .graph_object import Graph
7
9
 
8
- TGraphCreateResult = TypeVar("TGraphCreateResult", bound="GraphCreateResult")
9
-
10
10
 
11
11
  class GraphCreateResult(NamedTuple):
12
12
  """
@@ -16,7 +16,7 @@ class GraphCreateResult(NamedTuple):
16
16
  graph: Graph
17
17
  result: "Series[Any]"
18
18
 
19
- def __enter__(self: TGraphCreateResult) -> Graph:
19
+ def __enter__(self: GraphCreateResult) -> Graph:
20
20
  return self.graph
21
21
 
22
22
  def __exit__(
@@ -41,7 +41,7 @@ class GraphCypherRunner(CallerBase):
41
41
 
42
42
  GraphCypherRunner._verify_query_ends_with_return_clause(self._namespace, query)
43
43
 
44
- result = self._query_runner.run_query(query, params, database, False).squeeze()
44
+ result = self._query_runner.run_cypher(query, params, database, False).squeeze()
45
45
 
46
46
  try:
47
47
  graph_name = str(result["graphName"])
@@ -1,13 +1,6 @@
1
1
  from ..caller_base import CallerBase
2
2
  from .graph_alpha_proc_runner import GraphAlphaProcRunner
3
3
  from .graph_beta_proc_runner import GraphBetaProcRunner
4
- from .graph_proc_runner import GraphProcRunner
5
-
6
-
7
- class GraphEndpoints(CallerBase):
8
- @property
9
- def graph(self) -> GraphProcRunner:
10
- return GraphProcRunner(self._query_runner, f"{self._namespace}.graph", self._server_version)
11
4
 
12
5
 
13
6
  class GraphAlphaEndpoints(CallerBase):