graphdatascience 1.22__py3-none-any.whl → 2.0__py3-none-any.whl

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 (459) hide show
  1. graphdatascience/__init__.py +7 -30
  2. graphdatascience/arrow_client/arrow_authentication.py +2 -0
  3. graphdatascience/arrow_client/arrow_endpoint_version.py +19 -10
  4. graphdatascience/arrow_client/arrow_info.py +19 -8
  5. graphdatascience/arrow_client/arrow_table_utils.py +38 -0
  6. graphdatascience/arrow_client/authenticated_flight_client.py +121 -76
  7. graphdatascience/arrow_client/server_health_check.py +12 -0
  8. graphdatascience/arrow_client/v1/gds_arrow_client.py +52 -53
  9. graphdatascience/arrow_client/v2/api_types.py +2 -0
  10. graphdatascience/arrow_client/v2/gds_arrow_client.py +31 -30
  11. graphdatascience/arrow_client/v2/job_client.py +34 -8
  12. graphdatascience/datasets/graph_constructor_func.py +2 -2
  13. graphdatascience/datasets/nx_loader.py +3 -3
  14. graphdatascience/datasets/ogb_loader.py +5 -5
  15. graphdatascience/datasets/simple_file_loader.py +0 -11
  16. graphdatascience/error/cypher_warning_handler.py +6 -3
  17. graphdatascience/error/not_available_outside_aura.py +5 -0
  18. graphdatascience/error/standalone_session_error.py +3 -0
  19. graphdatascience/graph/__init__.py +3 -0
  20. graphdatascience/graph/{v2/graph_api.py → graph_api.py} +56 -24
  21. graphdatascience/graph/{v2/graph_backend.py → graph_backend.py} +1 -1
  22. graphdatascience/{procedure_surface/api/catalog → graph}/graph_info.py +9 -0
  23. graphdatascience/{query_runner/arrow_graph_constructor.py → graph_construction/arrow_v1_graph_constructor.py} +14 -34
  24. graphdatascience/graph_construction/arrow_v2_graph_constructor.py +102 -0
  25. graphdatascience/{query_runner → graph_construction}/cypher_graph_constructor.py +33 -146
  26. graphdatascience/graph_data_science.py +731 -174
  27. graphdatascience/ignored_server_endpoints.py +0 -6
  28. graphdatascience/model/model.py +62 -235
  29. graphdatascience/model/model_catalog_protocol.py +29 -0
  30. graphdatascience/model/{v2/model_details.py → model_details.py} +1 -1
  31. graphdatascience/procedure_surface/__init__.py +0 -3
  32. graphdatascience/procedure_surface/api/base_result.py +19 -1
  33. graphdatascience/procedure_surface/api/catalog/__init__.py +20 -5
  34. graphdatascience/procedure_surface/api/catalog/catalog_endpoints.py +96 -40
  35. graphdatascience/procedure_surface/api/catalog/dataset_endpoints.py +22 -14
  36. graphdatascience/procedure_surface/api/catalog/graph_export_endpoints.py +142 -0
  37. graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py +31 -23
  38. graphdatascience/procedure_surface/api/catalog/node_label_endpoints.py +7 -13
  39. graphdatascience/procedure_surface/api/catalog/node_properties_endpoints.py +13 -13
  40. graphdatascience/procedure_surface/api/catalog/node_property_endpoints.py +74 -0
  41. graphdatascience/procedure_surface/api/catalog/relationship_properties_endpoints.py +120 -0
  42. graphdatascience/procedure_surface/api/catalog/relationship_property_endpoints.py +65 -0
  43. graphdatascience/procedure_surface/api/catalog/relationships_data_frame.py +47 -0
  44. graphdatascience/procedure_surface/api/catalog/relationships_endpoints.py +28 -23
  45. graphdatascience/procedure_surface/api/catalog/scale_properties_endpoints.py +12 -12
  46. graphdatascience/procedure_surface/api/catalog/validation.py +17 -0
  47. graphdatascience/procedure_surface/api/centrality/__init__.py +10 -0
  48. graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py +19 -19
  49. graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py +10 -10
  50. graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py +17 -17
  51. graphdatascience/procedure_surface/api/centrality/bridges_endpoints.py +4 -4
  52. graphdatascience/procedure_surface/api/centrality/celf_endpoints.py +22 -22
  53. graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py +21 -12
  54. graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py +7 -7
  55. graphdatascience/procedure_surface/api/centrality/degree_endpoints.py +12 -12
  56. graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py +12 -12
  57. graphdatascience/procedure_surface/api/centrality/hits_endpoints.py +294 -0
  58. graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py +20 -20
  59. graphdatascience/procedure_surface/api/collapse_path_endpoints.py +5 -5
  60. graphdatascience/procedure_surface/api/community/clique_counting_endpoints.py +7 -7
  61. graphdatascience/procedure_surface/api/community/conductance_endpoints.py +3 -3
  62. graphdatascience/procedure_surface/api/community/hdbscan_endpoints.py +32 -32
  63. graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py +9 -9
  64. graphdatascience/procedure_surface/api/community/kcore_endpoints.py +8 -8
  65. graphdatascience/procedure_surface/api/community/kmeans_endpoints.py +27 -27
  66. graphdatascience/procedure_surface/api/community/labelpropagation_endpoints.py +12 -12
  67. graphdatascience/procedure_surface/api/community/leiden_endpoints.py +27 -27
  68. graphdatascience/procedure_surface/api/community/local_clustering_coefficient_endpoints.py +11 -11
  69. graphdatascience/procedure_surface/api/community/louvain_endpoints.py +18 -18
  70. graphdatascience/procedure_surface/api/community/maxkcut_endpoints.py +8 -8
  71. graphdatascience/procedure_surface/api/community/modularity_endpoints.py +5 -5
  72. graphdatascience/procedure_surface/api/community/modularity_optimization_endpoints.py +7 -7
  73. graphdatascience/procedure_surface/api/community/scc_endpoints.py +8 -8
  74. graphdatascience/procedure_surface/api/community/sllpa_endpoints.py +17 -17
  75. graphdatascience/procedure_surface/api/community/triangle_count_endpoints.py +17 -17
  76. graphdatascience/procedure_surface/api/community/triangles_endpoints.py +5 -5
  77. graphdatascience/procedure_surface/api/community/wcc_endpoints.py +15 -15
  78. graphdatascience/procedure_surface/api/config_endpoints.py +4 -4
  79. graphdatascience/procedure_surface/api/debug_endpoints.py +43 -0
  80. graphdatascience/procedure_surface/api/descriptions.py +3 -0
  81. graphdatascience/procedure_surface/api/estimation_result.py +3 -2
  82. graphdatascience/procedure_surface/api/job_handle.py +4 -4
  83. graphdatascience/procedure_surface/api/kge/__init__.py +17 -0
  84. graphdatascience/procedure_surface/api/kge/kge_endpoints.py +69 -0
  85. graphdatascience/procedure_surface/api/kge/kge_predict_endpoints.py +218 -0
  86. graphdatascience/procedure_surface/api/kge/simple_rel_embedding_model.py +227 -0
  87. graphdatascience/procedure_surface/api/license_endpoints.py +23 -0
  88. graphdatascience/procedure_surface/api/list_progress_endpoint.py +1 -1
  89. graphdatascience/procedure_surface/api/memory_endpoints.py +46 -0
  90. graphdatascience/procedure_surface/api/model/model_catalog_endpoints.py +4 -3
  91. graphdatascience/procedure_surface/api/node_embedding/__init__.py +28 -0
  92. graphdatascience/procedure_surface/api/node_embedding/config.py +81 -0
  93. graphdatascience/procedure_surface/api/node_embedding/embedding_endpoints.py +150 -0
  94. graphdatascience/procedure_surface/api/node_embedding/fastpath_endpoints.py +289 -0
  95. graphdatascience/procedure_surface/api/node_embedding/fastrp_endpoints.py +42 -42
  96. graphdatascience/procedure_surface/api/node_embedding/graphsage_endpoints.py +29 -22
  97. graphdatascience/procedure_surface/api/{model → node_embedding}/graphsage_model.py +27 -27
  98. graphdatascience/procedure_surface/api/node_embedding/graphsage_predict_endpoints.py +11 -11
  99. graphdatascience/procedure_surface/api/node_embedding/graphsage_train_endpoints.py +21 -21
  100. graphdatascience/procedure_surface/api/node_embedding/hashgnn_endpoints.py +38 -38
  101. graphdatascience/procedure_surface/api/node_embedding/node2vec_endpoints.py +62 -62
  102. graphdatascience/procedure_surface/api/pathfinding/__init__.py +2 -0
  103. graphdatascience/procedure_surface/api/pathfinding/all_shortest_path_endpoints.py +4 -4
  104. graphdatascience/procedure_surface/api/pathfinding/bfs_endpoints.py +10 -10
  105. graphdatascience/procedure_surface/api/pathfinding/dag_endpoints.py +7 -0
  106. graphdatascience/procedure_surface/api/pathfinding/dfs_endpoints.py +10 -10
  107. graphdatascience/procedure_surface/api/pathfinding/dijkstra_endpoints.py +13 -13
  108. graphdatascience/procedure_surface/api/pathfinding/k_spanning_tree_endpoints.py +3 -3
  109. graphdatascience/procedure_surface/api/pathfinding/longest_path_endpoints.py +3 -3
  110. graphdatascience/procedure_surface/api/pathfinding/max_flow_endpoints.py +7 -7
  111. graphdatascience/procedure_surface/api/pathfinding/max_flow_min_cost_endpoints.py +7 -7
  112. graphdatascience/procedure_surface/api/pathfinding/prize_steiner_tree_endpoints.py +13 -13
  113. graphdatascience/procedure_surface/api/pathfinding/random_walk_endpoints.py +6 -6
  114. graphdatascience/procedure_surface/api/pathfinding/single_source_bellman_ford_endpoints.py +12 -12
  115. graphdatascience/procedure_surface/api/pathfinding/single_source_delta_endpoints.py +15 -15
  116. graphdatascience/procedure_surface/api/pathfinding/single_source_dijkstra_endpoints.py +9 -9
  117. graphdatascience/procedure_surface/api/pathfinding/source_target_astar_endpoints.py +21 -21
  118. graphdatascience/procedure_surface/api/pathfinding/source_target_dijkstra_endpoints.py +13 -13
  119. graphdatascience/procedure_surface/api/pathfinding/source_target_yens_endpoints.py +13 -13
  120. graphdatascience/procedure_surface/api/pathfinding/spanning_tree_endpoints.py +13 -13
  121. graphdatascience/procedure_surface/api/pathfinding/steiner_tree_endpoints.py +23 -23
  122. graphdatascience/procedure_surface/api/pathfinding/topological_sort_endpoints.py +54 -0
  123. graphdatascience/procedure_surface/api/pipeline/__init__.py +4 -2
  124. graphdatascience/procedure_surface/api/{model → pipeline}/link_prediction_model.py +10 -10
  125. graphdatascience/procedure_surface/api/pipeline/link_prediction_pipeline.py +12 -6
  126. graphdatascience/procedure_surface/api/pipeline/link_prediction_pipeline_endpoints.py +20 -0
  127. graphdatascience/procedure_surface/api/pipeline/link_prediction_predict_endpoints.py +137 -4
  128. graphdatascience/procedure_surface/api/pipeline/link_prediction_train_endpoints.py +6 -6
  129. graphdatascience/procedure_surface/api/{model → pipeline}/node_classification_model.py +14 -12
  130. graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline.py +15 -7
  131. graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline_endpoints.py +20 -0
  132. graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline_results.py +1 -0
  133. graphdatascience/procedure_surface/api/pipeline/node_classification_predict_endpoints.py +6 -6
  134. graphdatascience/procedure_surface/api/pipeline/node_classification_train_endpoints.py +6 -6
  135. graphdatascience/procedure_surface/api/{model → pipeline}/node_regression_model.py +10 -10
  136. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline.py +11 -5
  137. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_endpoints.py +28 -7
  138. graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_protocol.py +4 -4
  139. graphdatascience/procedure_surface/api/pipeline/node_regression_predict_endpoints.py +4 -4
  140. graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_protocol.py +12 -1
  141. graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_result.py +19 -0
  142. graphdatascience/procedure_surface/api/pipeline/pipeline_endpoints.py +14 -15
  143. graphdatascience/procedure_surface/api/pipeline/pipeline_info_mapping.py +33 -0
  144. graphdatascience/procedure_surface/api/pipeline/pipeline_model.py +52 -0
  145. graphdatascience/procedure_surface/api/projection_job_handle.py +3 -3
  146. graphdatascience/procedure_surface/api/similarity/__init__.py +2 -0
  147. graphdatascience/procedure_surface/api/similarity/knn_endpoints.py +29 -29
  148. graphdatascience/procedure_surface/api/similarity/knn_filtered_endpoints.py +48 -48
  149. graphdatascience/procedure_surface/api/similarity/node_similarity_endpoints.py +43 -43
  150. graphdatascience/procedure_surface/api/similarity/node_similarity_filtered_endpoints.py +53 -53
  151. graphdatascience/procedure_surface/api/similarity/similarity_functions.py +186 -0
  152. graphdatascience/procedure_surface/api/topological_link_prediction_endpoints.py +187 -0
  153. graphdatascience/procedure_surface/api/util_endpoints.py +114 -0
  154. graphdatascience/procedure_surface/api/write_job_handle.py +8 -3
  155. graphdatascience/procedure_surface/api/write_protocol.py +34 -0
  156. graphdatascience/procedure_surface/arrow/catalog/__init__.py +6 -0
  157. graphdatascience/procedure_surface/arrow/catalog/catalog_arrow_endpoints.py +85 -344
  158. graphdatascience/procedure_surface/arrow/catalog/graph_backend_arrow.py +5 -4
  159. graphdatascience/procedure_surface/arrow/catalog/graph_export_arrow_endpoints.py +49 -0
  160. graphdatascience/procedure_surface/arrow/catalog/graph_ops_arrow.py +1 -1
  161. graphdatascience/procedure_surface/arrow/catalog/graph_sampling_arrow_endpoints.py +17 -4
  162. graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py +4 -8
  163. graphdatascience/procedure_surface/arrow/catalog/node_properties_arrow_endpoints.py +11 -8
  164. graphdatascience/procedure_surface/arrow/catalog/projection_arrow_endpoints.py +324 -0
  165. graphdatascience/procedure_surface/arrow/catalog/relationship_arrow_endpoints.py +15 -13
  166. graphdatascience/procedure_surface/arrow/catalog/scale_properties_arrow_endpoints.py +8 -11
  167. graphdatascience/procedure_surface/arrow/centrality/articlerank_arrow_endpoints.py +8 -8
  168. graphdatascience/procedure_surface/arrow/centrality/articulationpoints_arrow_endpoints.py +19 -12
  169. graphdatascience/procedure_surface/arrow/centrality/betweenness_arrow_endpoints.py +8 -8
  170. graphdatascience/procedure_surface/arrow/centrality/bridges_arrow_endpoints.py +5 -5
  171. graphdatascience/procedure_surface/arrow/centrality/celf_arrow_endpoints.py +8 -8
  172. graphdatascience/procedure_surface/arrow/centrality/closeness_arrow_endpoints.py +19 -8
  173. graphdatascience/procedure_surface/arrow/centrality/closeness_harmonic_arrow_endpoints.py +8 -8
  174. graphdatascience/procedure_surface/arrow/centrality/degree_arrow_endpoints.py +8 -8
  175. graphdatascience/procedure_surface/arrow/centrality/eigenvector_arrow_endpoints.py +8 -8
  176. graphdatascience/procedure_surface/arrow/centrality/hits_arrow_endpoints.py +253 -0
  177. graphdatascience/procedure_surface/arrow/centrality/pagerank_arrow_endpoints.py +11 -11
  178. graphdatascience/procedure_surface/arrow/collapse_path_arrow_endpoints.py +2 -2
  179. graphdatascience/procedure_surface/arrow/community/clique_counting_arrow_endpoints.py +8 -8
  180. graphdatascience/procedure_surface/arrow/community/conductance_arrow_endpoints.py +4 -8
  181. graphdatascience/procedure_surface/arrow/community/hdbscan_arrow_endpoints.py +8 -8
  182. graphdatascience/procedure_surface/arrow/community/k1coloring_arrow_endpoints.py +8 -8
  183. graphdatascience/procedure_surface/arrow/community/kcore_arrow_endpoints.py +8 -8
  184. graphdatascience/procedure_surface/arrow/community/kmeans_arrow_endpoints.py +8 -8
  185. graphdatascience/procedure_surface/arrow/community/labelpropagation_arrow_endpoints.py +8 -8
  186. graphdatascience/procedure_surface/arrow/community/leiden_arrow_endpoints.py +8 -8
  187. graphdatascience/procedure_surface/arrow/community/local_clustering_coefficient_arrow_endpoints.py +8 -8
  188. graphdatascience/procedure_surface/arrow/community/louvain_arrow_endpoints.py +8 -8
  189. graphdatascience/procedure_surface/arrow/community/maxkcut_arrow_endpoints.py +6 -6
  190. graphdatascience/procedure_surface/arrow/community/modularity_arrow_endpoints.py +6 -8
  191. graphdatascience/procedure_surface/arrow/community/modularity_optimization_arrow_endpoints.py +8 -8
  192. graphdatascience/procedure_surface/arrow/community/scc_arrow_endpoints.py +8 -8
  193. graphdatascience/procedure_surface/arrow/community/sllpa_arrow_endpoints.py +8 -8
  194. graphdatascience/procedure_surface/arrow/community/triangle_count_arrow_endpoints.py +8 -8
  195. graphdatascience/procedure_surface/arrow/community/triangles_arrow_endpoints.py +2 -2
  196. graphdatascience/procedure_surface/arrow/community/wcc_arrow_endpoints.py +8 -8
  197. graphdatascience/procedure_surface/arrow/endpoints_helper_base.py +20 -12
  198. graphdatascience/procedure_surface/arrow/jobs_arrow_endpoints.py +4 -4
  199. graphdatascience/procedure_surface/arrow/model/model_catalog_arrow_endpoints.py +1 -1
  200. graphdatascience/procedure_surface/arrow/node_embedding/embedding_arrow_endpoints.py +105 -0
  201. graphdatascience/procedure_surface/arrow/node_embedding/fastpath_arrow_endpoints.py +280 -0
  202. graphdatascience/procedure_surface/arrow/node_embedding/fastrp_arrow_endpoints.py +8 -8
  203. graphdatascience/procedure_surface/arrow/node_embedding/graphsage_predict_arrow_endpoints.py +7 -9
  204. graphdatascience/procedure_surface/arrow/node_embedding/graphsage_train_arrow_endpoints.py +10 -10
  205. graphdatascience/procedure_surface/arrow/node_embedding/hashgnn_arrow_endpoints.py +7 -7
  206. graphdatascience/procedure_surface/arrow/node_embedding/node2vec_arrow_endpoints.py +7 -7
  207. graphdatascience/procedure_surface/arrow/node_property_endpoints.py +2 -2
  208. graphdatascience/procedure_surface/arrow/pathfinding/all_shortest_path_arrow_endpoints.py +6 -9
  209. graphdatascience/procedure_surface/arrow/pathfinding/bfs_arrow_endpoints.py +9 -8
  210. graphdatascience/procedure_surface/arrow/pathfinding/dag_arrow_endpoints.py +9 -0
  211. graphdatascience/procedure_surface/arrow/pathfinding/dfs_arrow_endpoints.py +9 -8
  212. graphdatascience/procedure_surface/arrow/pathfinding/dijkstra_arrow_endpoints.py +8 -11
  213. graphdatascience/procedure_surface/arrow/pathfinding/k_spanning_tree_arrow_endpoints.py +4 -4
  214. graphdatascience/procedure_surface/arrow/pathfinding/longest_path_arrow_endpoints.py +4 -8
  215. graphdatascience/procedure_surface/arrow/pathfinding/max_flow_arrow_endpoints.py +9 -14
  216. graphdatascience/procedure_surface/arrow/pathfinding/max_flow_min_cost_arrow_endpoints.py +9 -14
  217. graphdatascience/procedure_surface/arrow/pathfinding/prize_steiner_tree_arrow_endpoints.py +9 -12
  218. graphdatascience/procedure_surface/arrow/pathfinding/random_walk_arrow_endpoints.py +7 -7
  219. graphdatascience/procedure_surface/arrow/pathfinding/shortest_path_arrow_endpoints.py +1 -1
  220. graphdatascience/procedure_surface/arrow/pathfinding/single_source_bellman_ford_arrow_endpoints.py +10 -10
  221. graphdatascience/procedure_surface/arrow/pathfinding/single_source_delta_arrow_endpoints.py +9 -13
  222. graphdatascience/procedure_surface/arrow/pathfinding/single_source_dijkstra_arrow_endpoints.py +8 -12
  223. graphdatascience/procedure_surface/arrow/pathfinding/source_target_astar_arrow_endpoints.py +8 -12
  224. graphdatascience/procedure_surface/arrow/pathfinding/source_target_dijkstra_arrow_endpoints.py +8 -11
  225. graphdatascience/procedure_surface/arrow/pathfinding/source_target_yens_arrow_endpoints.py +8 -12
  226. graphdatascience/procedure_surface/arrow/pathfinding/spanning_tree_arrow_endpoints.py +9 -12
  227. graphdatascience/procedure_surface/arrow/pathfinding/steiner_tree_arrow_endpoints.py +9 -12
  228. graphdatascience/procedure_surface/arrow/pathfinding/topological_sort_arrow_endpoints.py +47 -0
  229. graphdatascience/procedure_surface/arrow/pipeline/link_prediction_pipeline_arrow_endpoints.py +18 -9
  230. graphdatascience/procedure_surface/arrow/pipeline/link_prediction_predict_arrow_endpoints.py +10 -6
  231. graphdatascience/procedure_surface/arrow/pipeline/link_prediction_train_arrow_endpoints.py +10 -10
  232. graphdatascience/procedure_surface/arrow/pipeline/node_classification_pipeline_arrow_endpoints.py +18 -9
  233. graphdatascience/procedure_surface/arrow/pipeline/node_classification_predict_arrow_endpoints.py +6 -6
  234. graphdatascience/procedure_surface/arrow/pipeline/node_classification_train_arrow_endpoints.py +10 -10
  235. graphdatascience/procedure_surface/arrow/pipeline/node_regression_pipeline_arrow_endpoints.py +21 -13
  236. graphdatascience/procedure_surface/arrow/pipeline/node_regression_predict_arrow_endpoints.py +4 -4
  237. graphdatascience/procedure_surface/arrow/pipeline/pipeline_arrow_endpoints.py +1 -1
  238. graphdatascience/procedure_surface/arrow/pipeline/pipeline_catalog_arrow_endpoints.py +12 -6
  239. graphdatascience/procedure_surface/arrow/relationship_endpoints_helper.py +2 -2
  240. graphdatascience/procedure_surface/arrow/similarity/knn_arrow_endpoints.py +9 -13
  241. graphdatascience/procedure_surface/arrow/similarity/knn_filtered_arrow_endpoints.py +9 -13
  242. graphdatascience/procedure_surface/arrow/similarity/node_similarity_arrow_endpoints.py +16 -20
  243. graphdatascience/procedure_surface/arrow/similarity/node_similarity_filtered_arrow_endpoints.py +9 -13
  244. graphdatascience/procedure_surface/arrow/stream_result_mapper.py +47 -1
  245. graphdatascience/procedure_surface/arrow/util_arrow_endpoints.py +55 -0
  246. graphdatascience/procedure_surface/cypher/catalog/__init__.py +8 -0
  247. graphdatascience/procedure_surface/cypher/catalog/catalog_cypher_endpoints.py +107 -95
  248. graphdatascience/procedure_surface/cypher/catalog/graph_backend_cypher.py +39 -0
  249. graphdatascience/procedure_surface/cypher/catalog/graph_export_cypher_endpoints.py +97 -0
  250. graphdatascience/procedure_surface/cypher/catalog/graph_ops_cypher.py +55 -0
  251. graphdatascience/procedure_surface/cypher/catalog/graph_sampling_cypher_endpoints.py +22 -9
  252. graphdatascience/procedure_surface/cypher/catalog/node_label_cypher_endpoints.py +8 -18
  253. graphdatascience/procedure_surface/cypher/catalog/node_properties_cypher_endpoints.py +19 -11
  254. graphdatascience/procedure_surface/cypher/catalog/projection_cypher_endpoints.py +213 -0
  255. graphdatascience/procedure_surface/cypher/catalog/relationship_cypher_endpoints.py +41 -28
  256. graphdatascience/procedure_surface/cypher/catalog/scale_properties_cypher_endpoints.py +12 -12
  257. graphdatascience/procedure_surface/cypher/catalog/utils.py +20 -0
  258. graphdatascience/procedure_surface/cypher/centrality/articlerank_cypher_endpoints.py +12 -12
  259. graphdatascience/procedure_surface/cypher/centrality/articulationpoints_cypher_endpoints.py +12 -12
  260. graphdatascience/procedure_surface/cypher/centrality/betweenness_cypher_endpoints.py +12 -12
  261. graphdatascience/procedure_surface/cypher/centrality/bridges_cypher_endpoints.py +3 -3
  262. graphdatascience/procedure_surface/cypher/centrality/celf_cypher_endpoints.py +12 -12
  263. graphdatascience/procedure_surface/cypher/centrality/closeness_cypher_endpoints.py +20 -12
  264. graphdatascience/procedure_surface/cypher/centrality/closeness_harmonic_cypher_endpoints.py +12 -12
  265. graphdatascience/procedure_surface/cypher/centrality/degree_cypher_endpoints.py +12 -12
  266. graphdatascience/procedure_surface/cypher/centrality/eigenvector_cypher_endpoints.py +12 -12
  267. graphdatascience/procedure_surface/cypher/centrality/hits_cypher_endpoints.py +207 -0
  268. graphdatascience/procedure_surface/cypher/centrality/pagerank_cypher_endpoints.py +12 -12
  269. graphdatascience/procedure_surface/cypher/collapse_path_cypher_endpoints.py +4 -4
  270. graphdatascience/procedure_surface/cypher/community/clique_counting_cypher_endpoints.py +12 -12
  271. graphdatascience/procedure_surface/cypher/community/conductance_cypher_endpoints.py +2 -2
  272. graphdatascience/procedure_surface/cypher/community/hdbscan_cypher_endpoints.py +9 -9
  273. graphdatascience/procedure_surface/cypher/community/k1coloring_cypher_endpoints.py +12 -12
  274. graphdatascience/procedure_surface/cypher/community/kcore_cypher_endpoints.py +12 -12
  275. graphdatascience/procedure_surface/cypher/community/kmeans_cypher_endpoints.py +12 -12
  276. graphdatascience/procedure_surface/cypher/community/labelpropagation_cypher_endpoints.py +12 -12
  277. graphdatascience/procedure_surface/cypher/community/leiden_cypher_endpoints.py +12 -12
  278. graphdatascience/procedure_surface/cypher/community/local_clustering_coefficient_cypher_endpoints.py +12 -12
  279. graphdatascience/procedure_surface/cypher/community/louvain_cypher_endpoints.py +12 -12
  280. graphdatascience/procedure_surface/cypher/community/maxkcut_cypher_endpoints.py +6 -6
  281. graphdatascience/procedure_surface/cypher/community/modularity_cypher_endpoints.py +5 -5
  282. graphdatascience/procedure_surface/cypher/community/modularity_optimization_cypher_endpoints.py +9 -11
  283. graphdatascience/procedure_surface/cypher/community/scc_cypher_endpoints.py +14 -14
  284. graphdatascience/procedure_surface/cypher/community/sllpa_cypher_endpoints.py +9 -9
  285. graphdatascience/procedure_surface/cypher/community/triangle_count_cypher_endpoints.py +12 -12
  286. graphdatascience/procedure_surface/cypher/community/triangles_cypher_endpoints.py +2 -2
  287. graphdatascience/procedure_surface/cypher/community/wcc_cypher_endpoints.py +14 -14
  288. graphdatascience/procedure_surface/cypher/config_cypher_endpoints.py +2 -2
  289. graphdatascience/procedure_surface/cypher/debug_cypher_endpoints.py +15 -0
  290. graphdatascience/procedure_surface/cypher/estimation_utils.py +10 -10
  291. graphdatascience/procedure_surface/cypher/kge/__init__.py +5 -0
  292. graphdatascience/procedure_surface/cypher/kge/kge_predict_cypher_endpoints.py +148 -0
  293. graphdatascience/procedure_surface/cypher/license_cypher_endpoints.py +22 -0
  294. graphdatascience/procedure_surface/cypher/list_progress_cypher_endpoint.py +1 -1
  295. graphdatascience/procedure_surface/cypher/memory_cypher_endpoints.py +21 -0
  296. graphdatascience/procedure_surface/cypher/model/model_catalog_cypher_endpoints.py +24 -8
  297. graphdatascience/procedure_surface/cypher/node_embedding/fastrp_cypher_endpoints.py +12 -12
  298. graphdatascience/procedure_surface/cypher/node_embedding/graphsage_predict_cypher_endpoints.py +7 -7
  299. graphdatascience/procedure_surface/cypher/node_embedding/graphsage_train_cypher_endpoints.py +9 -9
  300. graphdatascience/procedure_surface/cypher/node_embedding/hashgnn_cypher_endpoints.py +9 -9
  301. graphdatascience/procedure_surface/cypher/node_embedding/node2vec_cypher_endpoints.py +12 -12
  302. graphdatascience/procedure_surface/cypher/pathfinding/all_shortest_path_cypher_endpoints.py +3 -3
  303. graphdatascience/procedure_surface/cypher/pathfinding/bfs_cypher_endpoints.py +13 -13
  304. graphdatascience/procedure_surface/cypher/pathfinding/dag_cypher_endpoints.py +9 -0
  305. graphdatascience/procedure_surface/cypher/pathfinding/dfs_cypher_endpoints.py +13 -13
  306. graphdatascience/procedure_surface/cypher/pathfinding/dijkstra_cypher_endpoints.py +7 -7
  307. graphdatascience/procedure_surface/cypher/pathfinding/k_spanning_tree_cypher_endpoints.py +5 -5
  308. graphdatascience/procedure_surface/cypher/pathfinding/longest_path_cypher_endpoints.py +2 -2
  309. graphdatascience/procedure_surface/cypher/pathfinding/max_flow_cypher_endpoints.py +12 -12
  310. graphdatascience/procedure_surface/cypher/pathfinding/max_flow_min_cost_cypher_endpoints.py +12 -12
  311. graphdatascience/procedure_surface/cypher/pathfinding/prize_steiner_tree_cypher_endpoints.py +9 -9
  312. graphdatascience/procedure_surface/cypher/pathfinding/random_walk_cypher_endpoints.py +9 -9
  313. graphdatascience/procedure_surface/cypher/pathfinding/single_source_bellman_ford_cypher_endpoints.py +9 -9
  314. graphdatascience/procedure_surface/cypher/pathfinding/single_source_delta_cypher_endpoints.py +9 -9
  315. graphdatascience/procedure_surface/cypher/pathfinding/single_source_dijkstra_cypher_endpoints.py +7 -7
  316. graphdatascience/procedure_surface/cypher/pathfinding/source_target_astar_cypher_endpoints.py +7 -7
  317. graphdatascience/procedure_surface/cypher/pathfinding/source_target_dijkstra_cypher_endpoints.py +7 -7
  318. graphdatascience/procedure_surface/cypher/pathfinding/source_target_yens_cypher_endpoints.py +7 -7
  319. graphdatascience/procedure_surface/cypher/pathfinding/spanning_tree_cypher_endpoints.py +15 -15
  320. graphdatascience/procedure_surface/cypher/pathfinding/steiner_tree_cypher_endpoints.py +11 -15
  321. graphdatascience/procedure_surface/cypher/pathfinding/topological_sort_cypher_endpoints.py +47 -0
  322. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_pipeline_cypher_endpoints.py +32 -21
  323. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_predict_cypher_endpoints.py +7 -7
  324. graphdatascience/procedure_surface/cypher/pipeline/link_prediction_train_cypher_endpoints.py +11 -11
  325. graphdatascience/procedure_surface/cypher/pipeline/node_classification_pipeline_cypher_endpoints.py +32 -21
  326. graphdatascience/procedure_surface/cypher/pipeline/node_classification_predict_cypher_endpoints.py +10 -10
  327. graphdatascience/procedure_surface/cypher/pipeline/node_classification_train_cypher_endpoints.py +11 -11
  328. graphdatascience/procedure_surface/cypher/pipeline/node_regression_pipeline_cypher_endpoints.py +37 -28
  329. graphdatascience/procedure_surface/cypher/pipeline/node_regression_predict_cypher_endpoints.py +5 -5
  330. graphdatascience/procedure_surface/cypher/pipeline/pipeline_catalog_cypher_endpoints.py +22 -8
  331. graphdatascience/procedure_surface/cypher/similarity/knn_cypher_endpoints.py +9 -9
  332. graphdatascience/procedure_surface/cypher/similarity/knn_filtered_cypher_endpoints.py +9 -9
  333. graphdatascience/procedure_surface/cypher/similarity/node_similarity_cypher_endpoints.py +9 -9
  334. graphdatascience/procedure_surface/cypher/similarity/node_similarity_filtered_cypher_endpoints.py +9 -9
  335. graphdatascience/procedure_surface/cypher/topological_link_prediction_cypher_endpoints.py +138 -0
  336. graphdatascience/procedure_surface/cypher/util_cypher_endpoints.py +42 -0
  337. graphdatascience/procedure_surface/utils/node_matching.py +37 -0
  338. graphdatascience/procedure_surface/utils/result_utils.py +21 -0
  339. graphdatascience/{query_runner/progress → progress}/progress_bar.py +15 -4
  340. graphdatascience/{query_runner/progress → progress}/query_progress_logger.py +3 -9
  341. graphdatascience/{query_runner/progress → progress}/query_progress_provider.py +2 -11
  342. graphdatascience/query_runner/db_environment_resolver.py +2 -2
  343. graphdatascience/query_runner/neo4j_query_runner.py +40 -86
  344. graphdatascience/query_runner/query_runner.py +8 -11
  345. graphdatascience/query_runner/termination_flag.py +2 -0
  346. graphdatascience/retry_utils/neo4j_retry_helper.py +0 -3
  347. graphdatascience/retry_utils/retry_config.py +1 -1
  348. graphdatascience/session/aura_api.py +145 -12
  349. graphdatascience/session/aura_api_responses.py +27 -2
  350. graphdatascience/session/aura_api_token_authentication.py +1 -1
  351. graphdatascience/session/aura_graph_data_science.py +844 -156
  352. graphdatascience/session/dbms_connection_info.py +3 -1
  353. graphdatascience/session/endpoint_mappings.py +30 -0
  354. graphdatascience/session/gds_sessions.py +278 -30
  355. graphdatascience/{query_runner/protocol → session/remote_ops}/project_protocols.py +33 -23
  356. graphdatascience/{query_runner/protocol → session/remote_ops}/projection_runner.py +15 -4
  357. graphdatascience/{query_runner/protocol → session/remote_ops}/write_protocols.py +48 -46
  358. graphdatascience/session/session_info.py +7 -4
  359. graphdatascience/session/session_lifecycle_manager.py +59 -4
  360. graphdatascience/session/session_sizes.py +6 -2
  361. graphdatascience/version.py +2 -2
  362. graphdatascience/versions/__init__.py +4 -0
  363. {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/METADATA +63 -26
  364. graphdatascience-2.0.dist-info/RECORD +470 -0
  365. {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/WHEEL +1 -1
  366. graphdatascience/algo/algo_endpoints.py +0 -24
  367. graphdatascience/algo/algo_proc_runner.py +0 -45
  368. graphdatascience/algo/single_mode_algo_endpoints.py +0 -18
  369. graphdatascience/call_builder.py +0 -21
  370. graphdatascience/caller_base.py +0 -23
  371. graphdatascience/endpoints.py +0 -116
  372. graphdatascience/error/client_only_endpoint.py +0 -47
  373. graphdatascience/error/endpoint_suggester.py +0 -29
  374. graphdatascience/error/illegal_attr_checker.py +0 -16
  375. graphdatascience/error/uncallable_namespace.py +0 -16
  376. graphdatascience/graph/base_graph_proc_runner.py +0 -570
  377. graphdatascience/graph/graph_alpha_proc_runner.py +0 -81
  378. graphdatascience/graph/graph_beta_proc_runner.py +0 -43
  379. graphdatascience/graph/graph_create_result.py +0 -28
  380. graphdatascience/graph/graph_cypher_runner.py +0 -125
  381. graphdatascience/graph/graph_endpoints.py +0 -15
  382. graphdatascience/graph/graph_entity_ops_runner.py +0 -426
  383. graphdatascience/graph/graph_export_runner.py +0 -52
  384. graphdatascience/graph/graph_object.py +0 -232
  385. graphdatascience/graph/graph_proc_runner.py +0 -15
  386. graphdatascience/graph/graph_project_runner.py +0 -72
  387. graphdatascience/graph/graph_remote_proc_runner.py +0 -76
  388. graphdatascience/graph/graph_sample_runner.py +0 -72
  389. graphdatascience/graph/graph_type_check.py +0 -34
  390. graphdatascience/graph/nx_loader.py +0 -46
  391. graphdatascience/graph/ogb_loader.py +0 -76
  392. graphdatascience/graph/v2/__init__.py +0 -4
  393. graphdatascience/graph/v2/graph_backend_cypher.py +0 -54
  394. graphdatascience/model/graphsage_model.py +0 -56
  395. graphdatascience/model/link_prediction_model.py +0 -45
  396. graphdatascience/model/model_alpha_proc_runner.py +0 -51
  397. graphdatascience/model/model_beta_proc_runner.py +0 -33
  398. graphdatascience/model/model_endpoints.py +0 -22
  399. graphdatascience/model/model_proc_runner.py +0 -151
  400. graphdatascience/model/model_resolver.py +0 -21
  401. graphdatascience/model/node_classification_model.py +0 -78
  402. graphdatascience/model/node_regression_model.py +0 -25
  403. graphdatascience/model/pipeline_model.py +0 -104
  404. graphdatascience/model/simple_rel_embedding_model.py +0 -196
  405. graphdatascience/model/v2/model.py +0 -55
  406. graphdatascience/model/v2/model_api.py +0 -45
  407. graphdatascience/pipeline/classification_training_pipeline.py +0 -67
  408. graphdatascience/pipeline/lp_pipeline_create_runner.py +0 -20
  409. graphdatascience/pipeline/lp_training_pipeline.py +0 -52
  410. graphdatascience/pipeline/nc_pipeline_create_runner.py +0 -20
  411. graphdatascience/pipeline/nc_training_pipeline.py +0 -52
  412. graphdatascience/pipeline/nr_pipeline_create_runner.py +0 -20
  413. graphdatascience/pipeline/nr_training_pipeline.py +0 -83
  414. graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -25
  415. graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -79
  416. graphdatascience/pipeline/pipeline_endpoints.py +0 -116
  417. graphdatascience/pipeline/pipeline_proc_runner.py +0 -88
  418. graphdatascience/pipeline/training_pipeline.py +0 -269
  419. graphdatascience/plugin_v2_endpoints.py +0 -540
  420. graphdatascience/procedure_surface/arrow/model_api_arrow.py +0 -57
  421. graphdatascience/procedure_surface/cypher/model_api_cypher.py +0 -49
  422. graphdatascience/query_runner/arrow_authentication/__init__.py +0 -3
  423. graphdatascience/query_runner/arrow_info/__init__.py +0 -5
  424. graphdatascience/query_runner/arrow_query_runner.py +0 -272
  425. graphdatascience/query_runner/gds_arrow_client.py +0 -1004
  426. graphdatascience/query_runner/progress/__init__.py +0 -0
  427. graphdatascience/query_runner/protocol/__init__.py +0 -0
  428. graphdatascience/query_runner/session_query_runner.py +0 -231
  429. graphdatascience/query_runner/standalone_session_query_runner.py +0 -109
  430. graphdatascience/semantic_version/__init__.py +0 -0
  431. graphdatascience/server_version/__init__.py +0 -0
  432. graphdatascience/server_version/compatible_with.py +0 -43
  433. graphdatascience/session/dedicated_sessions.py +0 -286
  434. graphdatascience/session/session_v2_endpoints.py +0 -593
  435. graphdatascience/system/__init__.py +0 -0
  436. graphdatascience/system/config_endpoints.py +0 -61
  437. graphdatascience/system/system_endpoints.py +0 -144
  438. graphdatascience/topological_lp/__init__.py +0 -0
  439. graphdatascience/topological_lp/topological_lp_alpha_endpoints.py +0 -8
  440. graphdatascience/topological_lp/topological_lp_alpha_runner.py +0 -52
  441. graphdatascience/topological_lp/topological_lp_runner.py +0 -72
  442. graphdatascience/utils/__init__.py +0 -0
  443. graphdatascience/utils/direct_util_endpoints.py +0 -115
  444. graphdatascience/utils/util_node_property_func_runner.py +0 -31
  445. graphdatascience/utils/util_proc_runner.py +0 -60
  446. graphdatascience/utils/util_remote_proc_runner.py +0 -55
  447. graphdatascience-1.22.dist-info/RECORD +0 -496
  448. /graphdatascience/{algo → graph_construction}/__init__.py +0 -0
  449. /graphdatascience/{query_runner → graph_construction}/graph_constructor.py +0 -0
  450. /graphdatascience/{model/v2 → progress}/__init__.py +0 -0
  451. /graphdatascience/{query_runner/progress → progress}/progress_provider.py +0 -0
  452. /graphdatascience/{query_runner/progress → progress}/static_progress_provider.py +0 -0
  453. /graphdatascience/{pipeline → session/remote_ops}/__init__.py +0 -0
  454. /graphdatascience/{query_runner/protocol → session/remote_ops}/arrow_config.py +0 -0
  455. /graphdatascience/{query_runner/protocol → session/remote_ops}/status.py +0 -0
  456. /graphdatascience/{semantic_version → versions}/semantic_version.py +0 -0
  457. /graphdatascience/{server_version → versions}/server_version.py +0 -0
  458. {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/licenses/LICENSE +0 -0
  459. {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/top_level.txt +0 -0
@@ -1,36 +1,13 @@
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__
1
+ from graphdatascience.graph.graph_api import Graph
2
+ from graphdatascience.graph_data_science import GraphDataScience
3
+ from graphdatascience.session import GdsSessions
4
+ from graphdatascience.version import __version__
5
+ from graphdatascience.versions import ServerVersion
17
6
 
18
7
  __all__ = [
19
- "GraphDataScience",
20
- "GdsSessions",
21
- "QueryRunner",
22
8
  "__version__",
23
9
  "ServerVersion",
10
+ "GraphDataScience",
11
+ "GdsSessions",
24
12
  "Graph",
25
- "GraphCreateResult",
26
- "LPTrainingPipeline",
27
- "NCTrainingPipeline",
28
- "NRTrainingPipeline",
29
- "NodePropertyStep",
30
- "LinkFeature",
31
- "LPModel",
32
- "NCModel",
33
- "NRModel",
34
- "GraphSageModel",
35
- "SimpleRelEmbeddingModel",
36
13
  ]
@@ -3,6 +3,8 @@ from dataclasses import dataclass
3
3
 
4
4
 
5
5
  class ArrowAuthentication(ABC):
6
+ """Abstract authentication strategy for the GDS Arrow server."""
7
+
6
8
  @abstractmethod
7
9
  def auth_pair(self) -> tuple[str, str]:
8
10
  """Returns the auth pair used for authentication."""
@@ -2,26 +2,35 @@ from __future__ import annotations
2
2
 
3
3
  from enum import Enum
4
4
 
5
+ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
6
+
5
7
 
6
8
  class ArrowEndpointVersion(Enum):
7
- V1 = "v1/"
8
- V2 = "v2/"
9
+ V1 = "v1"
10
+ V2 = "v2"
9
11
 
10
12
  def version(self) -> str:
11
13
  return self._name_.lower()
12
14
 
13
15
  def prefix(self) -> str:
14
- return self._value_
16
+ return f"{self._value_}/"
15
17
 
16
18
  @staticmethod
17
- def from_arrow_info(supported_arrow_versions: list[str]) -> ArrowEndpointVersion:
18
- # If the server supports versioned endpoints, we try v1 first
19
- if ArrowEndpointVersion.V1.version() in supported_arrow_versions:
20
- return ArrowEndpointVersion.V1
19
+ def check_version_compatibility(
20
+ compatible_versions: set[ArrowEndpointVersion], arrow_client: AuthenticatedArrowClient
21
+ ) -> None:
22
+ supported_server_versions = {
23
+ action.type.split("/")[0].lower() for action in arrow_client.list_actions_with_retry()
24
+ }
25
+ for version in compatible_versions:
26
+ if version.version() in supported_server_versions:
27
+ return
21
28
 
22
- raise UnsupportedArrowEndpointVersion(supported_arrow_versions)
29
+ raise UnsupportedArrowEndpointVersion(compatible_versions, supported_server_versions)
23
30
 
24
31
 
25
32
  class UnsupportedArrowEndpointVersion(Exception):
26
- def __init__(self, server_version: list[str]) -> None:
27
- super().__init__(self, f"Unsupported Arrow endpoint versions: {server_version}")
33
+ def __init__(self, compatible_versions: set[ArrowEndpointVersion], supported_server_versions: set[str]) -> None:
34
+ super().__init__(
35
+ f"The GDS version is not supported by this client version, please update the `graphdatascience` package. Arrow versions supported by this client are: {compatible_versions}, but GDS supports: {supported_server_versions}",
36
+ )
@@ -2,9 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
4
 
5
+ from neo4j.exceptions import Neo4jError
6
+
5
7
  from graphdatascience.query_runner.query_runner import QueryRunner
6
8
  from graphdatascience.query_runner.query_type import QueryType
7
- from graphdatascience.server_version.server_version import ServerVersion
8
9
 
9
10
 
10
11
  @dataclass(frozen=True)
@@ -16,13 +17,17 @@ class ArrowInfo:
16
17
 
17
18
  @staticmethod
18
19
  def create(query_runner: QueryRunner) -> ArrowInfo:
19
- debugYields = ["listenAddress", "enabled", "running"]
20
- if query_runner.server_version() > ServerVersion(2, 6, 0):
21
- debugYields.append("versions")
22
-
23
- procResult = query_runner.call_procedure(
24
- endpoint="gds.debug.arrow", query_type=QueryType.SYSTEM, custom_error=False, yields=debugYields
25
- ).iloc[0]
20
+ try:
21
+ procResult = query_runner.call_procedure(
22
+ endpoint="gds.debug.arrow",
23
+ query_type=QueryType.SYSTEM,
24
+ custom_error=False,
25
+ yields=["listenAddress", "enabled", "running", "versions"],
26
+ ).iloc[0]
27
+ except Neo4jError as e:
28
+ if ArrowInfo._procedure_not_registered(e):
29
+ return ArrowInfo(listenAddress="", enabled=False, running=False, versions=[])
30
+ raise
26
31
 
27
32
  return ArrowInfo(
28
33
  listenAddress=procResult["listenAddress"],
@@ -30,3 +35,9 @@ class ArrowInfo:
30
35
  running=procResult["running"],
31
36
  versions=procResult.get("versions", []),
32
37
  )
38
+
39
+ @staticmethod
40
+ def _procedure_not_registered(e: Neo4jError) -> bool:
41
+ return e.code == "Neo.ClientError.Procedure.ProcedureNotFound" or (
42
+ "no procedure with the name `gds.debug.arrow`" in e.message
43
+ )
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ import pandas
4
+ import pyarrow
5
+ from pyarrow import types as pa_types
6
+
7
+
8
+ def _downcast_type(data_type: pyarrow.DataType) -> pyarrow.DataType:
9
+ """Map pyarrow "large" string/binary types back to their 32-bit variants.
10
+
11
+ pandas 3.0 introduced a default string dtype that ``pyarrow.Table.from_pandas``
12
+ maps to ``large_string`` (LargeUTF8), whereas pandas 2.x produced ``string``
13
+ (UTF8). The GDS server expects UTF8, so we coerce the large variants back.
14
+ List containers are preserved as-is, only their element type is downcast.
15
+ """
16
+ if pa_types.is_large_string(data_type):
17
+ return pyarrow.string()
18
+
19
+ return data_type
20
+
21
+
22
+ def table_from_pandas(data: pandas.DataFrame) -> pyarrow.Table:
23
+ """Convert a DataFrame to a pyarrow Table, coercing large string/binary types to UTF8/binary.
24
+
25
+ Use this instead of ``pyarrow.Table.from_pandas`` so the produced schema stays
26
+ consistent across pandas 2.x and 3.0 (see :func:`_downcast_type`).
27
+ """
28
+ table = pyarrow.Table.from_pandas(data)
29
+
30
+ new_types = [_downcast_type(field.type) for field in table.schema]
31
+ if all(new_type == field.type for new_type, field in zip(new_types, table.schema)):
32
+ return table
33
+
34
+ new_schema = pyarrow.schema(
35
+ [field.with_type(new_type) for field, new_type in zip(table.schema, new_types)],
36
+ metadata=table.schema.metadata,
37
+ )
38
+ return table.cast(new_schema)
@@ -2,10 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  import json
4
4
  import logging
5
+ import math
5
6
  import platform
6
7
  from dataclasses import dataclass
7
8
  from types import TracebackType
8
- from typing import Any, Iterator, Type
9
+ from typing import Any, Callable, Iterator, Type, TypeVar
9
10
 
10
11
  import certifi
11
12
  from pyarrow import Schema, flight
@@ -13,6 +14,7 @@ from pyarrow import __version__ as arrow_version
13
14
  from pyarrow.flight import (
14
15
  Action,
15
16
  ActionType,
17
+ FlightCallOptions,
16
18
  FlightInternalError,
17
19
  FlightStreamReader,
18
20
  FlightTimedOutError,
@@ -22,7 +24,7 @@ from pyarrow.flight import (
22
24
  )
23
25
 
24
26
  from graphdatascience.arrow_client.arrow_authentication import ArrowAuthentication
25
- from graphdatascience.arrow_client.arrow_info import ArrowInfo
27
+ from graphdatascience.arrow_client.server_health_check import ServerHealthCheck
26
28
  from graphdatascience.retry_utils.retry_config import ExponentialWaitConfig, RetryConfigV2, StopConfig
27
29
 
28
30
  from ..version import __version__
@@ -30,102 +32,103 @@ from .arrow_client_options_util import TLS_ROOT_CERTS_OPTION, set_tls_root_certs
30
32
  from .middleware.auth_middleware import AuthFactory, AuthMiddleware
31
33
  from .middleware.user_agent_middleware import UserAgentFactory
32
34
 
35
+ T = TypeVar("T")
33
36
 
34
- class AuthenticatedArrowClient:
35
- @staticmethod
36
- def create(
37
- arrow_info: ArrowInfo,
38
- auth: ArrowAuthentication | None = None,
39
- encrypted: bool = False,
40
- arrow_client_options: dict[str, Any] | None = None,
41
- connection_string_override: str | None = None,
42
- retry_config: RetryConfigV2 | None = None,
43
- advertised_listen_address: tuple[str, int] | None = None,
44
- ) -> AuthenticatedArrowClient:
45
- connection_string: str
46
- if connection_string_override is not None:
47
- connection_string = connection_string_override
48
- else:
49
- connection_string = arrow_info.listenAddress
37
+ FLIGHT_TRANSIENT_EXCEPTIONS = (
38
+ FlightTimedOutError,
39
+ FlightUnavailableError,
40
+ FlightInternalError,
41
+ )
50
42
 
51
- host, port = connection_string.split(":")
43
+ DEFAULT_MAX_ATTEMPTS = 5
44
+ DEFAULT_CALL_TIMEOUT = 30.0
45
+ # Sum of the backoff waits between DEFAULT_MAX_ATTEMPTS attempts under the default
46
+ # wait config `ExponentialWaitConfig(multiplier=1, min=1, max=10)`: 1 + 2 + 4 + 8.
47
+ DEFAULT_BACKOFF_TOTAL = 15
52
48
 
53
- if retry_config is None:
54
- retry_config = RetryConfigV2(
55
- retryable_exceptions=[
56
- FlightTimedOutError,
57
- FlightUnavailableError,
58
- FlightInternalError,
59
- ],
60
- stop_config=StopConfig(after_delay=10, after_attempt=5),
61
- wait_config=ExponentialWaitConfig(multiplier=1, min=1, max=10),
62
- )
63
-
64
- return AuthenticatedArrowClient(
65
- host=host,
66
- retry_config=retry_config,
67
- port=int(port),
68
- auth=auth,
69
- encrypted=encrypted,
70
- arrow_client_options=arrow_client_options,
71
- advertised_listen_address=advertised_listen_address,
72
- )
49
+
50
+ def _default_retry_config(call_timeout: float | None) -> RetryConfigV2:
51
+ # The delay budget must fit all attempts even when every single one runs into the
52
+ # per-call deadline, plus the backoff waits in between. Otherwise one
53
+ # `Deadline Exceeded` exhausts the budget and no retry ever happens.
54
+ budget_timeout = call_timeout if call_timeout is not None else DEFAULT_CALL_TIMEOUT
55
+ after_delay = math.ceil(DEFAULT_MAX_ATTEMPTS * budget_timeout + DEFAULT_BACKOFF_TOTAL)
56
+ return RetryConfigV2(
57
+ retryable_exceptions=list(FLIGHT_TRANSIENT_EXCEPTIONS),
58
+ stop_config=StopConfig(after_delay=after_delay, after_attempt=DEFAULT_MAX_ATTEMPTS),
59
+ wait_config=ExponentialWaitConfig(multiplier=1, min=1, max=10),
60
+ )
61
+
62
+
63
+ class AuthenticatedArrowClient:
64
+ """Arrow Flight client used to communicate with the GDS Arrow server."""
73
65
 
74
66
  def __init__(
75
67
  self,
76
- host: str,
77
- retry_config: RetryConfigV2,
78
- port: int = 8491,
68
+ connection_info: str | tuple[str, int],
79
69
  auth: ArrowAuthentication | None = None,
80
70
  encrypted: bool = False,
81
71
  arrow_client_options: dict[str, Any] | None = None,
82
72
  user_agent: str | None = None,
83
73
  advertised_listen_address: tuple[str, int] | None = None,
74
+ retry_config: RetryConfigV2 | None = None,
75
+ health_check: ServerHealthCheck | None = None,
84
76
  ):
85
77
  """Creates a new AuthenticatedArrowClient instance.
86
78
 
87
79
  Parameters
88
80
  ----------
89
- host: str
90
- The host address of the GDS Arrow server
91
- port: int
92
- The host port of the GDS Arrow server (default is 8491)
93
- auth: ArrowAuthentication | None
81
+ connection_info
82
+ The host address and port of the GDS Arrow server
83
+ auth
94
84
  An implementation of ArrowAuthentication providing a pair to be used for basic authentication
95
- encrypted: bool
85
+ encrypted
96
86
  A flag that indicates whether the connection should be encrypted (default is False)
97
- arrow_client_options: dict[str, Any] | None
98
- Additional options to be passed to the Arrow Flight client.
99
- user_agent: str | None
100
- The user agent string to use for the connection. (default is `neo4j-graphdatascience-v[VERSION] pyarrow-v[PYARROW_VERSION])
101
- retry_config: RetryConfig | None
87
+ arrow_client_options
88
+ Additional options for the Arrow Flight client. The key ``call_timeout`` sets the
89
+ per-call RPC timeout in seconds (default 30s); all other keys are forwarded to
90
+ ``pyarrow.flight.FlightClient``.
91
+ user_agent
92
+ The user agent string to use for the connection. (default is `neo4j-graphdatascience-v[VERSION] pyarrow-v[PYARROW_VERSION]`)
93
+ retry_config
102
94
  The retry configuration to use for the Arrow requests send by the client.
103
- advertised_listen_address: tuple[str, int] | None
95
+ (default: up to 5 attempts with a total delay budget derived from the
96
+ per-call ``call_timeout`` so that timed-out calls are actually retried)
97
+ advertised_listen_address
104
98
  The advertised listen address of the GDS Arrow server. This will be used by remote projection and writeback operations.
99
+ health_check
100
+ Optional health check consulted when the server could not be reached, after all retries were
101
+ exhausted. It is expected to raise a more descriptive error if it can explain the failure (such as out-of-memory error) and to return without raising otherwise.
105
102
  """
103
+
104
+ if isinstance(connection_info, str):
105
+ host, port_str = connection_info.split(":")
106
+ port = int(port_str)
107
+ else:
108
+ host, port = connection_info
109
+
110
+ options_copy = dict(arrow_client_options) if arrow_client_options else {}
111
+ call_timeout = options_copy.pop("call_timeout", DEFAULT_CALL_TIMEOUT)
112
+
113
+ if retry_config is None:
114
+ retry_config = _default_retry_config(call_timeout)
115
+
106
116
  self._host = host
107
- self._port = port
108
- self._auth = None
117
+ self._port = int(port)
118
+ self._auth = auth
109
119
  self._encrypted = encrypted
110
- self._arrow_client_options = arrow_client_options
120
+ self._arrow_client_options = options_copy or None
111
121
  self._user_agent = user_agent
112
122
  self._logger = logging.getLogger("gds_arrow_client")
113
123
  self._retry_config = retry_config
124
+ self._health_check = health_check
114
125
  if auth:
115
- self._auth = auth
116
126
  self._auth_middleware = AuthMiddleware(auth)
127
+ self._call_timeout = call_timeout
128
+ self._call_options = self._build_call_options()
117
129
  self.advertised_listen_address = advertised_listen_address
118
-
119
130
  self._flight_client: flight.FlightClient = self._instantiate_flight_client()
120
131
 
121
- def _reconnect(self) -> None:
122
- try:
123
- self._flight_client.close()
124
- except Exception:
125
- pass
126
-
127
- self._flight_client = self._instantiate_flight_client()
128
-
129
132
  def connection_info(self) -> ConnectionInfo:
130
133
  """
131
134
  Returns the host and port of the GDS Arrow server.
@@ -168,13 +171,13 @@ class AuthenticatedArrowClient:
168
171
  client = self._flight_client
169
172
  if self._auth:
170
173
  auth_pair = self._auth.auth_pair()
171
- client.authenticate_basic_token(auth_pair[0], auth_pair[1])
172
- except (FlightTimedOutError, FlightUnavailableError, FlightInternalError):
174
+ client.authenticate_basic_token(auth_pair[0], auth_pair[1], self._call_options)
175
+ except FLIGHT_TRANSIENT_EXCEPTIONS:
173
176
  self._reconnect()
174
177
  raise
175
178
 
176
179
  if self._auth:
177
- auth_with_retry()
180
+ self._diagnose_connection_failure(auth_with_retry)
178
181
  return self._auth_middleware.token()
179
182
  else:
180
183
  return "IGNORED"
@@ -185,7 +188,7 @@ class AuthenticatedArrowClient:
185
188
  def do_action(self, endpoint: str, payload: bytes | dict[str, Any]) -> Iterator[Result]:
186
189
  payload_bytes = payload if isinstance(payload, bytes) else json.dumps(payload).encode("utf-8")
187
190
 
188
- return self._flight_client.do_action(Action(endpoint, payload_bytes)) # type: ignore
191
+ return self._flight_client.do_action(Action(endpoint, payload_bytes), self._call_options) # type: ignore
189
192
 
190
193
  def do_action_with_retry(self, endpoint: str, payload: bytes | dict[str, Any]) -> list[Result]:
191
194
  @self._retry_config.decorator(operation_name="Send action", logger=self._logger)
@@ -194,14 +197,25 @@ class AuthenticatedArrowClient:
194
197
  # the Flight response error code is only checked on iterator consumption
195
198
  # we eagerly collect iterator here to trigger retry in case of an error
196
199
  return list(self.do_action(endpoint, payload))
197
- except (FlightTimedOutError, FlightUnavailableError, FlightInternalError):
200
+ except FLIGHT_TRANSIENT_EXCEPTIONS:
198
201
  self._reconnect()
199
202
  raise
200
203
 
201
- return run_with_retry()
204
+ return self._diagnose_connection_failure(run_with_retry)
202
205
 
203
206
  def list_actions(self) -> set[ActionType]:
204
- return self._flight_client.list_actions() # type: ignore
207
+ return self._flight_client.list_actions(self._call_options) # type: ignore
208
+
209
+ def list_actions_with_retry(self) -> set[ActionType]:
210
+ @self._retry_config.decorator(operation_name="List actions", logger=self._logger)
211
+ def run_with_retry() -> set[ActionType]:
212
+ try:
213
+ return self.list_actions()
214
+ except (FlightTimedOutError, FlightUnavailableError, FlightInternalError):
215
+ self._reconnect()
216
+ raise
217
+
218
+ return self._diagnose_connection_failure(run_with_retry)
205
219
 
206
220
  def do_put_with_retry(
207
221
  self, descriptor: flight.FlightDescriptor, schema: Schema
@@ -210,11 +224,23 @@ class AuthenticatedArrowClient:
210
224
  def run_with_retry() -> tuple[flight.FlightStreamWriter, flight.FlightMetadataReader]:
211
225
  try:
212
226
  return self._flight_client.do_put(descriptor, schema) # type: ignore
213
- except (FlightTimedOutError, FlightUnavailableError, FlightInternalError):
227
+ except FLIGHT_TRANSIENT_EXCEPTIONS:
214
228
  self._reconnect()
215
229
  raise
216
230
 
217
- return run_with_retry()
231
+ return self._diagnose_connection_failure(run_with_retry)
232
+
233
+ def _diagnose_connection_failure(self, operation: Callable[[], T]) -> T:
234
+ """
235
+ Runs the given operation and, if the server could not be reached, gives the health check
236
+ the chance to raise a more descriptive error.
237
+ """
238
+ try:
239
+ return operation()
240
+ except FLIGHT_TRANSIENT_EXCEPTIONS:
241
+ if self._health_check:
242
+ self._health_check.raise_if_unhealthy()
243
+ raise
218
244
 
219
245
  def __enter__(self) -> AuthenticatedArrowClient:
220
246
  return self
@@ -231,6 +257,9 @@ class AuthenticatedArrowClient:
231
257
  if self._flight_client:
232
258
  self._flight_client.close()
233
259
 
260
+ def _build_call_options(self) -> FlightCallOptions | None:
261
+ return FlightCallOptions(timeout=self._call_timeout) if self._call_timeout is not None else None
262
+
234
263
  def _instantiate_flight_client(self) -> flight.FlightClient:
235
264
  location = (
236
265
  flight.Location.for_grpc_tls(self._host, self._port)
@@ -261,15 +290,31 @@ class AuthenticatedArrowClient:
261
290
  # Remove the FlightClient as it isn't serializable
262
291
  if "_flight_client" in state:
263
292
  del state["_flight_client"]
293
+ # FlightCallOptions is also not serializable
294
+ if "_call_options" in state:
295
+ del state["_call_options"]
264
296
  return state
265
297
 
266
298
  def __setstate__(self, state: dict[str, Any]) -> None:
267
299
  self.__dict__.update(state)
300
+ self.__dict__.setdefault("_health_check", None)
301
+ self.__dict__.setdefault("_call_timeout", DEFAULT_CALL_TIMEOUT)
302
+ self.__dict__.setdefault("_call_options", self._build_call_options())
303
+ self._flight_client = self._instantiate_flight_client()
304
+
305
+ def _reconnect(self) -> None:
306
+ try:
307
+ self._flight_client.close()
308
+ except Exception:
309
+ pass
310
+
268
311
  self._flight_client = self._instantiate_flight_client()
269
312
 
270
313
 
271
314
  @dataclass
272
315
  class ConnectionInfo:
316
+ """Host, port and encryption details for an Arrow server connection."""
317
+
273
318
  host: str
274
319
  port: int
275
320
  encrypted: bool
@@ -0,0 +1,12 @@
1
+ from typing import Protocol
2
+
3
+
4
+ class ServerHealthCheck(Protocol):
5
+ """Protocol for checking GDS Arrow server health before use."""
6
+
7
+ def raise_if_unhealthy(self) -> None:
8
+ """
9
+ Raises a descriptive error if the server is known to be in an unhealthy state,
10
+ and returns without raising if the state could not be determined.
11
+ """
12
+ ...