graphdatascience 1.8__tar.gz → 1.10a1__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.10a1}/PKG-INFO +5 -2
  2. {graphdatascience-1.8 → graphdatascience-1.10a1}/README.md +1 -0
  3. graphdatascience-1.10a1/graphdatascience/__init__.py +36 -0
  4. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/algo/algo_proc_runner.py +3 -9
  5. graphdatascience-1.10a1/graphdatascience/call_parameters.py +8 -0
  6. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/caller_base.py +5 -1
  7. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/endpoints.py +1 -6
  8. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/endpoint_suggester.py +1 -1
  9. graphdatascience-1.8/graphdatascience/graph/graph_proc_runner.py → graphdatascience-1.10a1/graphdatascience/graph/base_graph_proc_runner.py +100 -84
  10. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_alpha_proc_runner.py +6 -8
  11. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_beta_proc_runner.py +8 -8
  12. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_create_result.py +4 -4
  13. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_cypher_runner.py +1 -1
  14. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_endpoints.py +0 -7
  15. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_entity_ops_runner.py +85 -79
  16. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_export_runner.py +5 -8
  17. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_object.py +16 -13
  18. graphdatascience-1.10a1/graphdatascience/graph/graph_proc_runner.py +15 -0
  19. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_project_runner.py +32 -25
  20. graphdatascience-1.10a1/graphdatascience/graph/graph_remote_proc_runner.py +9 -0
  21. graphdatascience-1.10a1/graphdatascience/graph/graph_remote_project_runner.py +40 -0
  22. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_sample_runner.py +19 -21
  23. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/ogb_loader.py +2 -2
  24. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph_data_science.py +36 -96
  25. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/graphsage_model.py +8 -5
  26. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/link_prediction_model.py +2 -2
  27. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/model.py +26 -16
  28. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/model_alpha_proc_runner.py +15 -20
  29. graphdatascience-1.10a1/graphdatascience/model/model_beta_proc_runner.py +31 -0
  30. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/model_proc_runner.py +23 -33
  31. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/node_classification_model.py +8 -5
  32. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/node_regression_model.py +2 -2
  33. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/simple_rel_embedding_model.py +44 -96
  34. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/classification_training_pipeline.py +17 -12
  35. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/lp_pipeline_create_runner.py +3 -3
  36. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/lp_training_pipeline.py +8 -9
  37. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/nc_pipeline_create_runner.py +3 -3
  38. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/nc_training_pipeline.py +6 -5
  39. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/nr_pipeline_create_runner.py +3 -3
  40. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/nr_training_pipeline.py +12 -11
  41. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/pipeline_proc_runner.py +10 -14
  42. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/training_pipeline.py +44 -38
  43. graphdatascience-1.10a1/graphdatascience/query_runner/arrow_endpoint_version.py +35 -0
  44. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/arrow_graph_constructor.py +19 -0
  45. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/arrow_query_runner.py +126 -27
  46. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/aura_db_arrow_query_runner.py +67 -41
  47. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/cypher_graph_constructor.py +3 -3
  48. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/neo4j_query_runner.py +103 -9
  49. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/query_runner.py +25 -5
  50. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/server_version/server_version.py +5 -6
  51. graphdatascience-1.10a1/graphdatascience/session/__init__.py +13 -0
  52. graphdatascience-1.10a1/graphdatascience/session/aura_api.py +300 -0
  53. graphdatascience-1.10a1/graphdatascience/session/aura_graph_data_science.py +181 -0
  54. graphdatascience-1.10a1/graphdatascience/session/dbms_connection_info.py +24 -0
  55. graphdatascience-1.10a1/graphdatascience/session/gds_sessions.py +240 -0
  56. graphdatascience-1.10a1/graphdatascience/session/region_suggester.py +17 -0
  57. graphdatascience-1.10a1/graphdatascience/session/schema.py +16 -0
  58. graphdatascience-1.10a1/graphdatascience/session/session_sizes.py +33 -0
  59. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/system/config_endpoints.py +5 -8
  60. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/system/system_endpoints.py +23 -37
  61. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/topological_lp/topological_lp_alpha_runner.py +2 -2
  62. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/utils/util_endpoints.py +11 -13
  63. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/utils/util_proc_runner.py +6 -6
  64. graphdatascience-1.10a1/graphdatascience/version.py +1 -0
  65. {graphdatascience-1.8 → graphdatascience-1.10a1/graphdatascience.egg-info}/PKG-INFO +5 -2
  66. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience.egg-info/SOURCES.txt +13 -1
  67. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience.egg-info/requires.txt +2 -1
  68. {graphdatascience-1.8 → graphdatascience-1.10a1}/requirements/base/base.txt +2 -1
  69. {graphdatascience-1.8 → graphdatascience-1.10a1}/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.10a1}/LICENSE +0 -0
  75. {graphdatascience-1.8 → graphdatascience-1.10a1}/MANIFEST.in +0 -0
  76. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/algo/__init__.py +0 -0
  77. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/algo/algo_endpoints.py +0 -0
  78. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/algo/single_mode_algo_endpoints.py +0 -0
  79. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/call_builder.py +0 -0
  80. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/__init__.py +0 -0
  81. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/client_only_endpoint.py +0 -0
  82. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/cypher_warning_handler.py +0 -0
  83. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/gds_not_installed.py +0 -0
  84. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/illegal_attr_checker.py +0 -0
  85. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/unable_to_connect.py +0 -0
  86. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/error/uncallable_namespace.py +0 -0
  87. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/__init__.py +0 -0
  88. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/graph_type_check.py +0 -0
  89. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/graph/nx_loader.py +0 -0
  90. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/ignored_server_endpoints.py +0 -0
  91. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/__init__.py +0 -0
  92. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/model_endpoints.py +0 -0
  93. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/model_resolver.py +0 -0
  94. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/model/pipeline_model.py +0 -0
  95. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/__init__.py +0 -0
  96. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -0
  97. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -0
  98. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/pipeline/pipeline_endpoints.py +0 -0
  99. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/py.typed +0 -0
  100. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/__init__.py +0 -0
  101. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/query_runner/graph_constructor.py +0 -0
  102. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/__init__.py +0 -0
  103. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/cora/__init__.py +0 -0
  104. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/cora/cora_nodes.parquet.gzip +0 -0
  105. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/cora/cora_rels.parquet.gzip +0 -0
  106. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/cora/serialize_cora.py +0 -0
  107. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/__init__.py +0 -0
  108. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_acted_in.parquet.gzip +0 -0
  109. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_actors.parquet.gzip +0 -0
  110. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_directed_in.parquet.gzip +0 -0
  111. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_directors.parquet.gzip +0 -0
  112. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_movies_with_genre.parquet.gzip +0 -0
  113. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/imdb_movies_without_genre.parquet.gzip +0 -0
  114. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/imdb/serialize_imdb.py +0 -0
  115. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/karate/__init__.py +0 -0
  116. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/karate/karate_club.parquet.gzip +0 -0
  117. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/__init__.py +0 -0
  118. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/artist_nodes.parquet.gzip +0 -0
  119. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/serialize_lastfm.py +0 -0
  120. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/user_friend_df_directed.parquet.gzip +0 -0
  121. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/user_listen_artist_rels.parquet.gzip +0 -0
  122. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/user_nodes.parquet.gzip +0 -0
  123. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/resources/lastfm/user_tag_artist_rels.parquet.gzip +0 -0
  124. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/server_version/__init__.py +0 -0
  125. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/server_version/compatible_with.py +0 -0
  126. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/system/__init__.py +0 -0
  127. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/topological_lp/__init__.py +0 -0
  128. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/topological_lp/topological_lp_endpoints.py +0 -0
  129. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience/utils/__init__.py +0 -0
  130. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience.egg-info/dependency_links.txt +0 -0
  131. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience.egg-info/not-zip-safe +0 -0
  132. {graphdatascience-1.8 → graphdatascience-1.10a1}/graphdatascience.egg-info/top_level.txt +0 -0
  133. {graphdatascience-1.8 → graphdatascience-1.10a1}/pyproject.toml +0 -0
  134. {graphdatascience-1.8 → graphdatascience-1.10a1}/requirements/base/networkx.txt +0 -0
  135. {graphdatascience-1.8 → graphdatascience-1.10a1}/requirements/base/ogb.txt +0 -0
  136. {graphdatascience-1.8 → graphdatascience-1.10a1}/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.10a1
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<15.0,>=10.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
@@ -24,7 +25,6 @@ from .graph_entity_ops_runner import (
24
25
  )
25
26
  from .graph_export_runner import GraphExportRunner
26
27
  from .graph_object import Graph
27
- from .graph_project_runner import GraphProjectRunner
28
28
  from .graph_sample_runner import GraphSampleRunner
29
29
  from .graph_type_check import (
30
30
  from_graph_type_check,
@@ -32,15 +32,24 @@ from .graph_type_check import (
32
32
  graph_type_check_optional,
33
33
  )
34
34
  from .ogb_loader import OGBLLoader, OGBNLoader
35
+ from graphdatascience.call_parameters import CallParameters
35
36
  from graphdatascience.graph.graph_create_result import GraphCreateResult
36
- from graphdatascience.graph.graph_cypher_runner import GraphCypherRunner
37
37
 
38
38
  Strings = Union[str, List[str]]
39
39
 
40
40
  is_neo4j_4_driver = ServerVersion.from_string(neo4j_driver_version) < ServerVersion(5, 0, 0)
41
41
 
42
42
 
43
- class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
43
+ class BaseGraphProcRunner(UncallableNamespace, IllegalAttrChecker):
44
+ def __init__(self, query_runner: Any, namespace: str, server_version: ServerVersion):
45
+ super().__init__(query_runner, namespace, server_version)
46
+ # Pandas 2.2.0 deprecated an API used by ArrowTable.to_pandas() (< pyarrow 14.0)
47
+ warnings.filterwarnings(
48
+ "ignore",
49
+ category=DeprecationWarning,
50
+ message=r"Passing a BlockManager to DataFrame is deprecated",
51
+ )
52
+
44
53
  @staticmethod
45
54
  def _path(package: str, resource: str) -> pathlib.Path:
46
55
  if sys.version_info >= (3, 9):
@@ -77,8 +86,11 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
77
86
 
78
87
  errors = []
79
88
 
80
- exists = self._query_runner.run_query(
81
- f"CALL gds.graph.exists('{graph_name}') YIELD exists", custom_error=False
89
+ exists = self._query_runner.call_procedure(
90
+ endpoint="gds.graph.exists",
91
+ params=CallParameters(graph_name=graph_name),
92
+ yields=["exists"],
93
+ custom_error=False,
82
94
  ).squeeze()
83
95
 
84
96
  # compare against True as (1) unit tests return None here and (2) numpys True does not work with `is True`.
@@ -213,11 +225,6 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
213
225
  self._namespace += ".networkx"
214
226
  return NXLoader(self._query_runner, self._namespace, self._server_version)
215
227
 
216
- @property
217
- def project(self) -> GraphProjectRunner:
218
- self._namespace += ".project"
219
- return GraphProjectRunner(self._query_runner, self._namespace, self._server_version)
220
-
221
228
  @property
222
229
  @compatible_with("graphProperty", min_inclusive=ServerVersion(2, 5, 0))
223
230
  def graphProperty(self) -> GraphPropertyRunner:
@@ -230,24 +237,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
230
237
  self._namespace += ".nodeLabel"
231
238
  return GraphLabelRunner(self._query_runner, self._namespace, self._server_version)
232
239
 
233
- @property
234
- def cypher(self) -> GraphCypherRunner:
235
- self._namespace += ".project"
236
- return GraphCypherRunner(self._query_runner, self._namespace, self._server_version)
237
-
238
240
  @compatible_with("generate", min_inclusive=ServerVersion(2, 5, 0))
239
241
  def generate(self, graph_name: str, node_count: int, average_degree: int, **config: Any) -> GraphCreateResult:
240
242
  self._namespace += ".generate"
243
+ params = CallParameters(
244
+ graph_name=graph_name, node_count=node_count, average_degree=average_degree, config=config
245
+ )
241
246
 
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()
247
+ result = self._query_runner.call_procedure(
248
+ endpoint=self._namespace,
249
+ params=params,
250
+ ).squeeze()
251
251
 
252
252
  return GraphCreateResult(Graph(graph_name, self._query_runner, self._server_version), result)
253
253
 
@@ -262,15 +262,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
262
262
  **config: Any,
263
263
  ) -> GraphCreateResult:
264
264
  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
- },
265
+ params = CallParameters(
266
+ graph_name=graph_name,
267
+ from_graph_name=from_G.name(),
268
+ node_filter=node_filter,
269
+ relationship_filter=relationship_filter,
270
+ config=config,
271
+ )
272
+ result = self._query_runner.call_procedure(
273
+ endpoint=self._namespace,
274
+ logging=True,
275
+ params=params,
274
276
  ).squeeze()
275
277
 
276
278
  return GraphCreateResult(Graph(graph_name, self._query_runner, self._server_version), result)
@@ -290,28 +292,30 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
290
292
  self._namespace += ".ogbl"
291
293
  return OGBLLoader(self._query_runner, self._namespace, self._server_version)
292
294
 
293
- @graph_type_check
294
295
  def drop(
295
296
  self,
296
- G: Graph,
297
+ graph: Union[Graph, str],
297
298
  failIfMissing: bool = False,
298
299
  dbName: str = "",
299
300
  username: Optional[str] = None,
300
301
  ) -> Optional["Series[Any]"]:
301
302
  self._namespace += ".drop"
302
303
 
303
- params = {
304
- "graph_name": G.name(),
305
- "fail_if_missing": failIfMissing,
306
- "db_name": dbName,
307
- }
304
+ if isinstance(graph, Graph):
305
+ graph = graph.name()
306
+
307
+ params = CallParameters(
308
+ graph_name=graph,
309
+ fail_if_missing=failIfMissing,
310
+ db_name=dbName,
311
+ )
308
312
  if username:
309
- query = f"CALL {self._namespace}($graph_name, $fail_if_missing, $db_name, $username)"
310
313
  params["username"] = username
311
- else:
312
- query = f"CALL {self._namespace}($graph_name, $fail_if_missing, $db_name)"
313
314
 
314
- result = self._query_runner.run_query(query, params)
315
+ result = self._query_runner.call_procedure(
316
+ endpoint=self._namespace,
317
+ params=params,
318
+ )
315
319
  if not result.empty:
316
320
  return result.squeeze() # type: ignore
317
321
 
@@ -319,7 +323,10 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
319
323
 
320
324
  def exists(self, graph_name: str) -> "Series[Any]":
321
325
  self._namespace += ".exists"
322
- result = self._query_runner.run_query(f"CALL {self._namespace}($graph_name)", {"graph_name": graph_name})
326
+ result = self._query_runner.call_procedure(
327
+ endpoint=self._namespace,
328
+ params=CallParameters(graph_name=graph_name),
329
+ )
323
330
 
324
331
  return result.squeeze() # type: ignore
325
332
 
@@ -327,19 +334,22 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
327
334
  def list(self, G: Optional[Graph] = None) -> DataFrame:
328
335
  self._namespace += ".list"
329
336
 
337
+ params = CallParameters()
330
338
  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 = {}
339
+ params["graph_name"] = G.name()
336
340
 
337
- return self._query_runner.run_query(query, params)
341
+ return self._query_runner.call_procedure(
342
+ endpoint=self._namespace,
343
+ params=params,
344
+ )
338
345
 
339
346
  @client_only_endpoint("gds.graph")
340
347
  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
348
+ result = self._query_runner.call_procedure(
349
+ endpoint="gds.graph.list",
350
+ params=CallParameters(graph_name=graph_name),
351
+ yields=["graphName"],
352
+ custom_error=False,
343
353
  )
344
354
  if len(result["graphName"]) == 0:
345
355
  raise ValueError(
@@ -356,15 +366,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
356
366
  entities: Strings,
357
367
  config: Dict[str, Any],
358
368
  ) -> 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
- }
369
+ params = CallParameters(
370
+ graph_name=G.name(),
371
+ properties=properties,
372
+ entities=entities,
373
+ config=config,
374
+ )
366
375
 
367
- return self._query_runner.run_query(query, params)
376
+ return self._query_runner.call_procedure(
377
+ endpoint=self._namespace,
378
+ params=params,
379
+ )
368
380
 
369
381
  @property
370
382
  def nodeProperty(self) -> GraphElementPropertyRunner:
@@ -491,16 +503,17 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
491
503
  **config: Any,
492
504
  ) -> "Series[Any]":
493
505
  self._namespace += ".writeRelationship"
506
+ params = CallParameters(
507
+ graph_name=G.name(),
508
+ relationship_type=relationship_type,
509
+ relationship_property=relationship_property,
510
+ config=config,
511
+ )
494
512
 
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
513
+ return self._query_runner.call_procedure( # type: ignore
514
+ endpoint=self._namespace,
515
+ params=params,
516
+ ).squeeze()
504
517
 
505
518
  @multimethod
506
519
  def removeNodeProperties(self) -> None:
@@ -515,15 +528,16 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
515
528
  **config: Any,
516
529
  ) -> Series: # type: ignore
517
530
  self._namespace += ".removeNodeProperties"
531
+ params = CallParameters(
532
+ graph_name=G.name(),
533
+ properties=node_properties,
534
+ config=config,
535
+ )
518
536
 
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
537
+ return self._query_runner.call_procedure( # type: ignore
538
+ endpoint=self._namespace,
539
+ params=params,
540
+ ).squeeze()
527
541
 
528
542
  @removeNodeProperties.register
529
543
  @compatible_with("removeNodeProperties", max_exclusive=ServerVersion(2, 1, 0))
@@ -543,10 +557,12 @@ class GraphProcRunner(UncallableNamespace, IllegalAttrChecker):
543
557
  def deleteRelationships(self, G: Graph, relationship_type: str) -> "Series[Any]":
544
558
  self._namespace += ".deleteRelationships"
545
559
 
546
- query = f"CALL {self._namespace}($graph_name, $relationship_type)"
547
- params = {
548
- "graph_name": G.name(),
549
- "relationship_type": relationship_type,
550
- }
560
+ params = CallParameters(
561
+ graph_name=G.name(),
562
+ relationship_type=relationship_type,
563
+ )
551
564
 
552
- return self._query_runner.run_query(query, params).squeeze() # type: ignore
565
+ return self._query_runner.call_procedure( # type: ignore
566
+ endpoint=self._namespace,
567
+ params=params,
568
+ ).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):