graphdatascience 1.16__tar.gz → 1.17__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 (281) hide show
  1. {graphdatascience-1.16/graphdatascience.egg-info → graphdatascience-1.17}/PKG-INFO +2 -1
  2. graphdatascience-1.17/graphdatascience/arrow_client/arrow_base_model.py +12 -0
  3. graphdatascience-1.17/graphdatascience/arrow_client/authenticated_flight_client.py +219 -0
  4. graphdatascience-1.17/graphdatascience/arrow_client/middleware/auth_middleware.py +63 -0
  5. graphdatascience-1.17/graphdatascience/arrow_client/middleware/user_agent_middleware.py +26 -0
  6. graphdatascience-1.17/graphdatascience/arrow_client/v2/api_types.py +17 -0
  7. graphdatascience-1.17/graphdatascience/arrow_client/v2/data_mapper_utils.py +19 -0
  8. graphdatascience-1.17/graphdatascience/arrow_client/v2/job_client.py +58 -0
  9. graphdatascience-1.17/graphdatascience/arrow_client/v2/mutation_client.py +18 -0
  10. graphdatascience-1.17/graphdatascience/arrow_client/v2/remote_write_back_client.py +79 -0
  11. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_cypher_runner.py +3 -1
  12. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_entity_ops_runner.py +5 -1
  13. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_object.py +1 -1
  14. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph_data_science.py +78 -11
  15. graphdatascience-1.17/graphdatascience/model/v2/model.py +59 -0
  16. graphdatascience-1.17/graphdatascience/model/v2/model_api.py +51 -0
  17. graphdatascience-1.17/graphdatascience/model/v2/model_details.py +20 -0
  18. graphdatascience-1.17/graphdatascience/procedure_surface/api/articlerank_endpoints.py +338 -0
  19. graphdatascience-1.17/graphdatascience/procedure_surface/api/articulationpoints_endpoints.py +243 -0
  20. graphdatascience-1.17/graphdatascience/procedure_surface/api/base_result.py +9 -0
  21. graphdatascience-1.17/graphdatascience/procedure_surface/api/betweenness_endpoints.py +293 -0
  22. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/graph_api.py +174 -0
  23. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/graph_backend.py +20 -0
  24. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/graph_info.py +38 -0
  25. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/node_label_endpoints.py +113 -0
  26. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/node_properties_endpoints.py +176 -0
  27. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog/relationships_endpoints.py +259 -0
  28. graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog_endpoints.py +225 -0
  29. graphdatascience-1.17/graphdatascience/procedure_surface/api/celf_endpoints.py +318 -0
  30. graphdatascience-1.17/graphdatascience/procedure_surface/api/closeness_endpoints.py +277 -0
  31. graphdatascience-1.17/graphdatascience/procedure_surface/api/closeness_harmonic_endpoints.py +261 -0
  32. graphdatascience-1.17/graphdatascience/procedure_surface/api/degree_endpoints.py +311 -0
  33. graphdatascience-1.17/graphdatascience/procedure_surface/api/eigenvector_endpoints.py +343 -0
  34. graphdatascience-1.17/graphdatascience/procedure_surface/api/estimation_result.py +21 -0
  35. graphdatascience-1.17/graphdatascience/procedure_surface/api/fastrp_endpoints.py +359 -0
  36. graphdatascience-1.17/graphdatascience/procedure_surface/api/graph_sampling_endpoints.py +181 -0
  37. graphdatascience-1.17/graphdatascience/procedure_surface/api/graphsage_predict_endpoints.py +230 -0
  38. graphdatascience-1.17/graphdatascience/procedure_surface/api/graphsage_train_endpoints.py +118 -0
  39. graphdatascience-1.17/graphdatascience/procedure_surface/api/hashgnn_endpoints.py +271 -0
  40. graphdatascience-1.17/graphdatascience/procedure_surface/api/k1coloring_endpoints.py +287 -0
  41. graphdatascience-1.17/graphdatascience/procedure_surface/api/kcore_endpoints.py +253 -0
  42. graphdatascience-1.17/graphdatascience/procedure_surface/api/louvain_endpoints.py +370 -0
  43. graphdatascience-1.17/graphdatascience/procedure_surface/api/model/graphsage_model.py +267 -0
  44. graphdatascience-1.17/graphdatascience/procedure_surface/api/node2vec_endpoints.py +386 -0
  45. graphdatascience-1.17/graphdatascience/procedure_surface/api/pagerank_endpoints.py +343 -0
  46. graphdatascience-1.17/graphdatascience/procedure_surface/api/scc_endpoints.py +265 -0
  47. graphdatascience-1.17/graphdatascience/procedure_surface/api/wcc_endpoints.py +316 -0
  48. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py +204 -0
  49. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py +143 -0
  50. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py +180 -0
  51. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog/graph_backend_arrow.py +33 -0
  52. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog/graph_ops_arrow.py +28 -0
  53. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py +78 -0
  54. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog/node_properties_arrow_endpoints.py +143 -0
  55. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog/relationship_arrow_endpoints.py +188 -0
  56. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py +260 -0
  57. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py +176 -0
  58. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py +157 -0
  59. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/closeness_harmonic_arrow_endpoints.py +145 -0
  60. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/degree_arrow_endpoints.py +155 -0
  61. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/eigenvector_arrow_endpoints.py +199 -0
  62. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/fastrp_arrow_endpoints.py +220 -0
  63. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/graph_sampling_arrow_endpoints.py +101 -0
  64. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/graphsage_predict_arrow_endpoints.py +156 -0
  65. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/graphsage_train_arrow_endpoints.py +90 -0
  66. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/hashgnn_arrow_endpoints.py +206 -0
  67. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/k1coloring_arrow_endpoints.py +168 -0
  68. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/kcore_arrow_endpoints.py +138 -0
  69. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/louvain_arrow_endpoints.py +210 -0
  70. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/model_api_arrow.py +57 -0
  71. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/node2vec_arrow_endpoints.py +244 -0
  72. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/node_property_endpoints.py +117 -0
  73. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/pagerank_arrow_endpoints.py +194 -0
  74. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/scc_arrow_endpoints.py +145 -0
  75. graphdatascience-1.17/graphdatascience/procedure_surface/arrow/wcc_arrow_endpoints.py +179 -0
  76. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/articlerank_cypher_endpoints.py +223 -0
  77. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/articulationpoints_cypher_endpoints.py +170 -0
  78. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/betweenness_cypher_endpoints.py +192 -0
  79. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog/graph_backend_cypher.py +57 -0
  80. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog/node_label_cypher_endpoints.py +78 -0
  81. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog/node_properties_cypher_endpoints.py +130 -0
  82. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog/relationship_cypher_endpoints.py +227 -0
  83. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog_cypher_endpoints.py +197 -0
  84. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/celf_cypher_endpoints.py +203 -0
  85. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/closeness_cypher_endpoints.py +175 -0
  86. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/closeness_harmonic_cypher_endpoints.py +169 -0
  87. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/degree_cypher_endpoints.py +180 -0
  88. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/eigenvector_cypher_endpoints.py +216 -0
  89. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/estimation_utils.py +60 -0
  90. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/fastrp_cypher_endpoints.py +245 -0
  91. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/graph_sampling_cypher_endpoints.py +106 -0
  92. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/graphsage_predict_cypher_endpoints.py +155 -0
  93. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/graphsage_train_cypher_endpoints.py +90 -0
  94. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/hashgnn_cypher_endpoints.py +219 -0
  95. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/k1coloring_cypher_endpoints.py +183 -0
  96. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/kcore_cypher_endpoints.py +158 -0
  97. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/louvain_cypher_endpoints.py +228 -0
  98. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/model_api_cypher.py +49 -0
  99. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/node2vec_cypher_endpoints.py +252 -0
  100. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/pagerank_cypher_endpoints.py +219 -0
  101. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/scc_cypher_endpoints.py +164 -0
  102. graphdatascience-1.17/graphdatascience/procedure_surface/cypher/wcc_cypher_endpoints.py +198 -0
  103. graphdatascience-1.17/graphdatascience/procedure_surface/utils/config_converter.py +38 -0
  104. graphdatascience-1.17/graphdatascience/procedure_surface/utils/result_utils.py +41 -0
  105. graphdatascience-1.17/graphdatascience/query_runner/arrow_authentication/__init__.py +3 -0
  106. graphdatascience-1.17/graphdatascience/query_runner/arrow_info/__init__.py +5 -0
  107. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/arrow_query_runner.py +12 -10
  108. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/cypher_graph_constructor.py +5 -1
  109. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/gds_arrow_client.py +58 -33
  110. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/neo4j_query_runner.py +23 -9
  111. graphdatascience-1.17/graphdatascience/query_runner/protocol/__init__.py +0 -0
  112. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/query_mode.py +8 -0
  113. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/query_runner.py +2 -0
  114. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/session_query_runner.py +4 -2
  115. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/standalone_session_query_runner.py +2 -0
  116. graphdatascience-1.17/graphdatascience/resources/__init__.py +0 -0
  117. graphdatascience-1.17/graphdatascience/resources/cora/__init__.py +0 -0
  118. graphdatascience-1.17/graphdatascience/resources/imdb/__init__.py +0 -0
  119. graphdatascience-1.17/graphdatascience/resources/karate/__init__.py +0 -0
  120. graphdatascience-1.17/graphdatascience/resources/lastfm/__init__.py +0 -0
  121. graphdatascience-1.17/graphdatascience/retry_utils/__init__.py +0 -0
  122. graphdatascience-1.17/graphdatascience/semantic_version/__init__.py +0 -0
  123. graphdatascience-1.17/graphdatascience/server_version/__init__.py +0 -0
  124. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/aura_api.py +11 -2
  125. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/aura_graph_data_science.py +31 -7
  126. graphdatascience-1.17/graphdatascience/session/aurads_sessions.py +0 -0
  127. graphdatascience-1.17/graphdatascience/session/dbms/__init__.py +0 -0
  128. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/dbms/protocol_resolver.py +3 -1
  129. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/dedicated_sessions.py +4 -0
  130. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/gds_sessions.py +4 -1
  131. graphdatascience-1.17/graphdatascience/session/session_v2_endpoints.py +115 -0
  132. graphdatascience-1.17/graphdatascience/system/__init__.py +0 -0
  133. graphdatascience-1.17/graphdatascience/topological_lp/__init__.py +0 -0
  134. graphdatascience-1.17/graphdatascience/utils/__init__.py +0 -0
  135. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/utils/direct_util_endpoints.py +3 -1
  136. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/utils/util_remote_proc_runner.py +4 -2
  137. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/version.py +1 -1
  138. {graphdatascience-1.16 → graphdatascience-1.17/graphdatascience.egg-info}/PKG-INFO +2 -1
  139. graphdatascience-1.17/graphdatascience.egg-info/SOURCES.txt +278 -0
  140. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience.egg-info/requires.txt +1 -0
  141. {graphdatascience-1.16 → graphdatascience-1.17}/requirements/base/base.txt +1 -0
  142. graphdatascience-1.16/graphdatascience.egg-info/SOURCES.txt +0 -162
  143. {graphdatascience-1.16 → graphdatascience-1.17}/LICENSE +0 -0
  144. {graphdatascience-1.16 → graphdatascience-1.17}/MANIFEST.in +0 -0
  145. {graphdatascience-1.16 → graphdatascience-1.17}/README.md +0 -0
  146. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/__init__.py +0 -0
  147. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/algo/__init__.py +0 -0
  148. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/algo/algo_endpoints.py +0 -0
  149. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/algo/algo_proc_runner.py +0 -0
  150. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/algo/single_mode_algo_endpoints.py +0 -0
  151. {graphdatascience-1.16/graphdatascience/error → graphdatascience-1.17/graphdatascience/arrow_client}/__init__.py +0 -0
  152. {graphdatascience-1.16/graphdatascience/query_runner → graphdatascience-1.17/graphdatascience/arrow_client}/arrow_authentication.py +0 -0
  153. {graphdatascience-1.16/graphdatascience/query_runner → graphdatascience-1.17/graphdatascience/arrow_client}/arrow_info.py +0 -0
  154. {graphdatascience-1.16/graphdatascience/graph → graphdatascience-1.17/graphdatascience/arrow_client/middleware}/__init__.py +0 -0
  155. {graphdatascience-1.16/graphdatascience/model → graphdatascience-1.17/graphdatascience/arrow_client/v2}/__init__.py +0 -0
  156. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/call_builder.py +0 -0
  157. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/call_parameters.py +0 -0
  158. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/caller_base.py +0 -0
  159. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/endpoints.py +0 -0
  160. {graphdatascience-1.16/graphdatascience/pipeline → graphdatascience-1.17/graphdatascience/error}/__init__.py +0 -0
  161. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/client_only_endpoint.py +0 -0
  162. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/cypher_warning_handler.py +0 -0
  163. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/endpoint_suggester.py +0 -0
  164. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/gds_not_installed.py +0 -0
  165. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/illegal_attr_checker.py +0 -0
  166. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/unable_to_connect.py +0 -0
  167. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/error/uncallable_namespace.py +0 -0
  168. {graphdatascience-1.16/graphdatascience/query_runner → graphdatascience-1.17/graphdatascience/graph}/__init__.py +0 -0
  169. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/base_graph_proc_runner.py +0 -0
  170. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_alpha_proc_runner.py +0 -0
  171. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_beta_proc_runner.py +0 -0
  172. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_create_result.py +0 -0
  173. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_endpoints.py +0 -0
  174. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_export_runner.py +0 -0
  175. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_proc_runner.py +0 -0
  176. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_project_runner.py +0 -0
  177. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_remote_proc_runner.py +0 -0
  178. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_remote_project_runner.py +0 -0
  179. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_sample_runner.py +0 -0
  180. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/graph_type_check.py +0 -0
  181. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/nx_loader.py +0 -0
  182. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/graph/ogb_loader.py +0 -0
  183. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/ignored_server_endpoints.py +0 -0
  184. {graphdatascience-1.16/graphdatascience/query_runner/progress → graphdatascience-1.17/graphdatascience/model}/__init__.py +0 -0
  185. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/graphsage_model.py +0 -0
  186. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/link_prediction_model.py +0 -0
  187. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model.py +0 -0
  188. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model_alpha_proc_runner.py +0 -0
  189. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model_beta_proc_runner.py +0 -0
  190. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model_endpoints.py +0 -0
  191. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model_proc_runner.py +0 -0
  192. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/model_resolver.py +0 -0
  193. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/node_classification_model.py +0 -0
  194. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/node_regression_model.py +0 -0
  195. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/pipeline_model.py +0 -0
  196. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/model/simple_rel_embedding_model.py +0 -0
  197. {graphdatascience-1.16/graphdatascience/query_runner/protocol → graphdatascience-1.17/graphdatascience/model/v2}/__init__.py +0 -0
  198. /graphdatascience-1.16/graphdatascience/py.typed → /graphdatascience-1.17/graphdatascience/model/v2/graphsage_model.py +0 -0
  199. {graphdatascience-1.16/graphdatascience/resources → graphdatascience-1.17/graphdatascience/pipeline}/__init__.py +0 -0
  200. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/classification_training_pipeline.py +0 -0
  201. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/lp_pipeline_create_runner.py +0 -0
  202. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/lp_training_pipeline.py +0 -0
  203. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/nc_pipeline_create_runner.py +0 -0
  204. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/nc_training_pipeline.py +0 -0
  205. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/nr_pipeline_create_runner.py +0 -0
  206. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/nr_training_pipeline.py +0 -0
  207. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -0
  208. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -0
  209. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/pipeline_endpoints.py +0 -0
  210. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/pipeline_proc_runner.py +0 -0
  211. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/pipeline/training_pipeline.py +0 -0
  212. {graphdatascience-1.16/graphdatascience/resources/cora → graphdatascience-1.17/graphdatascience/procedure_surface}/__init__.py +0 -0
  213. {graphdatascience-1.16/graphdatascience/resources/imdb → graphdatascience-1.17/graphdatascience/procedure_surface/api}/__init__.py +0 -0
  214. {graphdatascience-1.16/graphdatascience/resources/karate → graphdatascience-1.17/graphdatascience/procedure_surface/api/catalog}/__init__.py +0 -0
  215. {graphdatascience-1.16/graphdatascience/resources/lastfm → graphdatascience-1.17/graphdatascience/procedure_surface/api/model}/__init__.py +0 -0
  216. {graphdatascience-1.16/graphdatascience/retry_utils → graphdatascience-1.17/graphdatascience/procedure_surface/arrow}/__init__.py +0 -0
  217. {graphdatascience-1.16/graphdatascience/semantic_version → graphdatascience-1.17/graphdatascience/procedure_surface/arrow/catalog}/__init__.py +0 -0
  218. {graphdatascience-1.16/graphdatascience/server_version → graphdatascience-1.17/graphdatascience/procedure_surface/cypher}/__init__.py +0 -0
  219. {graphdatascience-1.16/graphdatascience/session/dbms → graphdatascience-1.17/graphdatascience/procedure_surface/cypher/catalog}/__init__.py +0 -0
  220. {graphdatascience-1.16/graphdatascience/system → graphdatascience-1.17/graphdatascience/procedure_surface/utils}/__init__.py +0 -0
  221. /graphdatascience-1.16/graphdatascience/session/aurads_sessions.py → /graphdatascience-1.17/graphdatascience/py.typed +0 -0
  222. {graphdatascience-1.16/graphdatascience/topological_lp → graphdatascience-1.17/graphdatascience/query_runner}/__init__.py +0 -0
  223. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/arrow_endpoint_version.py +0 -0
  224. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/arrow_graph_constructor.py +0 -0
  225. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/graph_constructor.py +0 -0
  226. {graphdatascience-1.16/graphdatascience/utils → graphdatascience-1.17/graphdatascience/query_runner/progress}/__init__.py +0 -0
  227. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/progress/progress_provider.py +0 -0
  228. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/progress/query_progress_logger.py +0 -0
  229. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/progress/query_progress_provider.py +0 -0
  230. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/progress/static_progress_provider.py +0 -0
  231. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/protocol/project_protocols.py +0 -0
  232. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/protocol/status.py +0 -0
  233. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/protocol/write_protocols.py +0 -0
  234. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/query_runner/termination_flag.py +0 -0
  235. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/cora/cora_nodes.parquet.gzip +0 -0
  236. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/cora/cora_rels.parquet.gzip +0 -0
  237. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/cora/serialize_cora.py +0 -0
  238. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_acted_in.parquet.gzip +0 -0
  239. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_actors.parquet.gzip +0 -0
  240. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_directed_in.parquet.gzip +0 -0
  241. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_directors.parquet.gzip +0 -0
  242. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_movies_with_genre.parquet.gzip +0 -0
  243. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/imdb_movies_without_genre.parquet.gzip +0 -0
  244. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/imdb/serialize_imdb.py +0 -0
  245. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/karate/karate_club.parquet.gzip +0 -0
  246. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/artist_nodes.parquet.gzip +0 -0
  247. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/serialize_lastfm.py +0 -0
  248. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/user_friend_df_directed.parquet.gzip +0 -0
  249. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/user_listen_artist_rels.parquet.gzip +0 -0
  250. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/user_nodes.parquet.gzip +0 -0
  251. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/resources/lastfm/user_tag_artist_rels.parquet.gzip +0 -0
  252. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/retry_utils/retry_config.py +0 -0
  253. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/retry_utils/retry_utils.py +0 -0
  254. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/semantic_version/semantic_version.py +0 -0
  255. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/server_version/compatible_with.py +0 -0
  256. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/server_version/server_version.py +0 -0
  257. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/__init__.py +0 -0
  258. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/algorithm_category.py +0 -0
  259. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/aura_api_responses.py +0 -0
  260. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/aura_api_token_authentication.py +0 -0
  261. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/cloud_location.py +0 -0
  262. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/dbms/protocol_version.py +0 -0
  263. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/dbms_connection_info.py +0 -0
  264. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/region_suggester.py +0 -0
  265. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/session_info.py +0 -0
  266. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/session/session_sizes.py +0 -0
  267. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/system/config_endpoints.py +0 -0
  268. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/system/system_endpoints.py +0 -0
  269. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/topological_lp/topological_lp_alpha_runner.py +0 -0
  270. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/topological_lp/topological_lp_endpoints.py +0 -0
  271. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/utils/util_node_property_func_runner.py +0 -0
  272. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience/utils/util_proc_runner.py +0 -0
  273. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience.egg-info/dependency_links.txt +0 -0
  274. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience.egg-info/not-zip-safe +0 -0
  275. {graphdatascience-1.16 → graphdatascience-1.17}/graphdatascience.egg-info/top_level.txt +0 -0
  276. {graphdatascience-1.16 → graphdatascience-1.17}/pyproject.toml +0 -0
  277. {graphdatascience-1.16 → graphdatascience-1.17}/requirements/base/networkx.txt +0 -0
  278. {graphdatascience-1.16 → graphdatascience-1.17}/requirements/base/ogb.txt +0 -0
  279. {graphdatascience-1.16 → graphdatascience-1.17}/requirements/base/rust-ext.txt +0 -0
  280. {graphdatascience-1.16 → graphdatascience-1.17}/setup.cfg +0 -0
  281. {graphdatascience-1.16 → graphdatascience-1.17}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphdatascience
3
- Version: 1.16
3
+ Version: 1.17
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
@@ -38,6 +38,7 @@ Requires-Dist: tqdm<5.0,>=4.0
38
38
  Requires-Dist: typing-extensions<5.0,>=4.0
39
39
  Requires-Dist: requests
40
40
  Requires-Dist: tenacity>=9.0
41
+ Requires-Dist: pydantic>=2.11
41
42
  Provides-Extra: ogb
42
43
  Requires-Dist: ogb<2.0,>=1.0; extra == "ogb"
43
44
  Provides-Extra: networkx
@@ -0,0 +1,12 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel
4
+ from pydantic.alias_generators import to_camel
5
+
6
+
7
+ class ArrowBaseModel(BaseModel, alias_generator=to_camel):
8
+ def dump_camel(self) -> dict[str, Any]:
9
+ return self.model_dump(by_alias=True)
10
+
11
+ def dump_json(self) -> str:
12
+ return self.model_dump_json(by_alias=True)
@@ -0,0 +1,219 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import logging
5
+ from dataclasses import dataclass
6
+ from typing import Any, Iterator, Optional, Tuple, Union
7
+
8
+ from pyarrow import __version__ as arrow_version
9
+ from pyarrow import flight
10
+ from pyarrow._flight import (
11
+ Action,
12
+ FlightInternalError,
13
+ FlightStreamReader,
14
+ FlightTimedOutError,
15
+ FlightUnavailableError,
16
+ Result,
17
+ Ticket,
18
+ )
19
+ from tenacity import retry, retry_any, retry_if_exception_type, stop_after_attempt, stop_after_delay, wait_exponential
20
+
21
+ from graphdatascience.arrow_client.arrow_authentication import ArrowAuthentication
22
+ from graphdatascience.arrow_client.arrow_info import ArrowInfo
23
+ from graphdatascience.retry_utils.retry_config import RetryConfig
24
+
25
+ from ..retry_utils.retry_utils import before_log
26
+ from ..version import __version__
27
+ from .middleware.auth_middleware import AuthFactory, AuthMiddleware
28
+ from .middleware.user_agent_middleware import UserAgentFactory
29
+
30
+
31
+ class AuthenticatedArrowClient:
32
+ @staticmethod
33
+ def create(
34
+ arrow_info: ArrowInfo,
35
+ auth: Optional[ArrowAuthentication] = None,
36
+ encrypted: bool = False,
37
+ arrow_client_options: Optional[dict[str, Any]] = None,
38
+ connection_string_override: Optional[str] = None,
39
+ retry_config: Optional[RetryConfig] = None,
40
+ advertised_listen_address: Optional[Tuple[str, int]] = None,
41
+ ) -> AuthenticatedArrowClient:
42
+ connection_string: str
43
+ if connection_string_override is not None:
44
+ connection_string = connection_string_override
45
+ else:
46
+ connection_string = arrow_info.listenAddress
47
+
48
+ host, port = connection_string.split(":")
49
+
50
+ if retry_config is None:
51
+ retry_config = RetryConfig(
52
+ retry=retry_any(
53
+ retry_if_exception_type(FlightTimedOutError),
54
+ retry_if_exception_type(FlightUnavailableError),
55
+ retry_if_exception_type(FlightInternalError),
56
+ ),
57
+ stop=(stop_after_delay(10) | stop_after_attempt(5)),
58
+ wait=wait_exponential(multiplier=1, min=1, max=10),
59
+ )
60
+
61
+ return AuthenticatedArrowClient(
62
+ host=host,
63
+ retry_config=retry_config,
64
+ port=int(port),
65
+ auth=auth,
66
+ encrypted=encrypted,
67
+ arrow_client_options=arrow_client_options,
68
+ advertised_listen_address=advertised_listen_address,
69
+ )
70
+
71
+ def __init__(
72
+ self,
73
+ host: str,
74
+ retry_config: RetryConfig,
75
+ port: int = 8491,
76
+ auth: Optional[ArrowAuthentication] = None,
77
+ encrypted: bool = False,
78
+ arrow_client_options: Optional[dict[str, Any]] = None,
79
+ user_agent: Optional[str] = None,
80
+ advertised_listen_address: Optional[Tuple[str, int]] = None,
81
+ ):
82
+ """Creates a new GdsArrowClient instance.
83
+
84
+ Parameters
85
+ ----------
86
+ host: str
87
+ The host address of the GDS Arrow server
88
+ port: int
89
+ The host port of the GDS Arrow server (default is 8491)
90
+ auth: Optional[ArrowAuthentication]
91
+ An implementation of ArrowAuthentication providing a pair to be used for basic authentication
92
+ encrypted: bool
93
+ A flag that indicates whether the connection should be encrypted (default is False)
94
+ arrow_client_options: Optional[dict[str, Any]]
95
+ Additional options to be passed to the Arrow Flight client.
96
+ user_agent: Optional[str]
97
+ The user agent string to use for the connection. (default is `neo4j-graphdatascience-v[VERSION] pyarrow-v[PYARROW_VERSION])
98
+ retry_config: Optional[RetryConfig]
99
+ The retry configuration to use for the Arrow requests send by the client.
100
+ advertised_listen_address: Optional[Tuple[str, int]]
101
+ The advertised listen address of the GDS Arrow server. This will be used by remote projection and writeback operations.
102
+ """
103
+ self._host = host
104
+ self._port = port
105
+ self._auth = None
106
+ self._encrypted = encrypted
107
+ self._arrow_client_options = arrow_client_options
108
+ self._user_agent = user_agent
109
+ self._retry_config = retry_config
110
+ self._logger = logging.getLogger("gds_arrow_client")
111
+ self._retry_config = retry_config
112
+ if auth:
113
+ self._auth = auth
114
+ self._auth_middleware = AuthMiddleware(auth)
115
+ self.advertised_listen_address = advertised_listen_address
116
+
117
+ self._flight_client = self._instantiate_flight_client()
118
+
119
+ def connection_info(self) -> ConnectionInfo:
120
+ """
121
+ Returns the host and port of the GDS Arrow server.
122
+
123
+ Returns
124
+ -------
125
+ tuple[str, int]
126
+ the host and port of the GDS Arrow server
127
+ """
128
+ return ConnectionInfo(self._host, self._port, self._encrypted)
129
+
130
+ def advertised_connection_info(self) -> ConnectionInfo:
131
+ """
132
+ Returns the advertised host and port of the GDS Arrow server.
133
+
134
+ Returns
135
+ -------
136
+ ConnectionInfo
137
+ the host and port of the GDS Arrow server
138
+ """
139
+ if self.advertised_listen_address is None:
140
+ return self.connection_info()
141
+
142
+ h, p = self.advertised_listen_address
143
+ return ConnectionInfo(h, p, self._encrypted)
144
+
145
+ def request_token(self) -> Optional[str]:
146
+ """
147
+ Requests a token from the server and returns it.
148
+
149
+ Returns
150
+ -------
151
+ Optional[str]
152
+ a token from the server and returns it.
153
+ """
154
+
155
+ @retry(
156
+ reraise=True,
157
+ before=before_log("Request token", self._logger, logging.DEBUG),
158
+ retry=self._retry_config.retry,
159
+ stop=self._retry_config.stop,
160
+ wait=self._retry_config.wait,
161
+ )
162
+ def auth_with_retry() -> None:
163
+ client = self._flight_client
164
+ if self._auth:
165
+ auth_pair = self._auth.auth_pair()
166
+ client.authenticate_basic_token(auth_pair[0], auth_pair[1])
167
+
168
+ if self._auth:
169
+ auth_with_retry()
170
+ return self._auth_middleware.token()
171
+ else:
172
+ return "IGNORED"
173
+
174
+ def get_stream(self, ticket: Ticket) -> FlightStreamReader:
175
+ return self._flight_client.do_get(ticket)
176
+
177
+ def do_action(self, endpoint: str, payload: Union[bytes, dict[str, Any]]) -> Iterator[Result]:
178
+ payload_bytes = payload if isinstance(payload, bytes) else json.dumps(payload).encode("utf-8")
179
+
180
+ return self._flight_client.do_action(Action(endpoint, payload_bytes)) # type: ignore
181
+
182
+ def do_action_with_retry(self, endpoint: str, payload: Union[bytes, dict[str, Any]]) -> Iterator[Result]:
183
+ @retry(
184
+ reraise=True,
185
+ before=before_log("Send action", self._logger, logging.DEBUG),
186
+ retry=self._retry_config.retry,
187
+ stop=self._retry_config.stop,
188
+ wait=self._retry_config.wait,
189
+ )
190
+ def run_with_retry() -> Iterator[Result]:
191
+ return self.do_action(endpoint, payload)
192
+
193
+ return run_with_retry()
194
+
195
+ def _instantiate_flight_client(self) -> flight.FlightClient:
196
+ location = (
197
+ flight.Location.for_grpc_tls(self._host, self._port)
198
+ if self._encrypted
199
+ else flight.Location.for_grpc_tcp(self._host, self._port)
200
+ )
201
+ client_options: dict[str, Any] = (self._arrow_client_options or {}).copy()
202
+ if self._auth:
203
+ user_agent = f"neo4j-graphdatascience-v{__version__} pyarrow-v{arrow_version}"
204
+ if self._user_agent:
205
+ user_agent = self._user_agent
206
+
207
+ client_options["middleware"] = [
208
+ AuthFactory(self._auth_middleware),
209
+ UserAgentFactory(useragent=user_agent),
210
+ ]
211
+
212
+ return flight.FlightClient(location, **client_options)
213
+
214
+
215
+ @dataclass
216
+ class ConnectionInfo:
217
+ host: str
218
+ port: int
219
+ encrypted: bool
@@ -0,0 +1,63 @@
1
+ from __future__ import annotations
2
+
3
+ import base64
4
+ import time
5
+ from typing import Any, Optional
6
+
7
+ from pyarrow._flight import ClientMiddleware, ClientMiddlewareFactory
8
+
9
+ from graphdatascience.arrow_client.arrow_authentication import ArrowAuthentication
10
+
11
+
12
+ class AuthFactory(ClientMiddlewareFactory): # type: ignore
13
+ def __init__(self, middleware: AuthMiddleware, *args: Any, **kwargs: Any) -> None:
14
+ super().__init__(*args, **kwargs)
15
+ self._middleware = middleware
16
+
17
+ def start_call(self, info: Any) -> AuthMiddleware:
18
+ return self._middleware
19
+
20
+
21
+ class AuthMiddleware(ClientMiddleware): # type: ignore
22
+ def __init__(self, auth: ArrowAuthentication, *args: Any, **kwargs: Any) -> None:
23
+ super().__init__(*args, **kwargs)
24
+ self._auth = auth
25
+ self._token: Optional[str] = None
26
+ self._token_timestamp = 0
27
+
28
+ def token(self) -> Optional[str]:
29
+ # check whether the token is older than 10 minutes. If so, reset it.
30
+ if self._token and int(time.time()) - self._token_timestamp > 600:
31
+ self._token = None
32
+
33
+ return self._token
34
+
35
+ def _set_token(self, token: str) -> None:
36
+ self._token = token
37
+ self._token_timestamp = int(time.time())
38
+
39
+ def received_headers(self, headers: dict[str, Any]) -> None:
40
+ auth_header = headers.get("authorization", None)
41
+ if not auth_header:
42
+ return
43
+
44
+ # the result is always a list
45
+ header_value = auth_header[0]
46
+
47
+ if not isinstance(header_value, str):
48
+ raise ValueError(f"Incompatible header value received from server: `{header_value}`")
49
+
50
+ auth_type, token = header_value.split(" ", 1)
51
+ if auth_type == "Bearer":
52
+ self._set_token(token)
53
+
54
+ def sending_headers(self) -> dict[str, str]:
55
+ token = self.token()
56
+ if token is not None:
57
+ return {"authorization": "Bearer " + token}
58
+
59
+ auth_pair = self._auth.auth_pair()
60
+ auth_token = f"{auth_pair[0]}:{auth_pair[1]}"
61
+ auth_token = "Basic " + base64.b64encode(auth_token.encode("utf-8")).decode("ASCII")
62
+ # There seems to be a bug, `authorization` must be lower key
63
+ return {"authorization": auth_token}
@@ -0,0 +1,26 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from pyarrow._flight import ClientMiddleware, ClientMiddlewareFactory
6
+
7
+
8
+ class UserAgentFactory(ClientMiddlewareFactory): # type: ignore
9
+ def __init__(self, useragent: str, *args: Any, **kwargs: Any) -> None:
10
+ super().__init__(*args, **kwargs)
11
+ self._middleware = UserAgentMiddleware(useragent)
12
+
13
+ def start_call(self, info: Any) -> ClientMiddleware:
14
+ return self._middleware
15
+
16
+
17
+ class UserAgentMiddleware(ClientMiddleware): # type: ignore
18
+ def __init__(self, useragent: str, *args: Any, **kwargs: Any) -> None:
19
+ super().__init__(*args, **kwargs)
20
+ self._useragent = useragent
21
+
22
+ def sending_headers(self) -> dict[str, str]:
23
+ return {"x-gds-user-agent": self._useragent}
24
+
25
+ def received_headers(self, headers: dict[str, Any]) -> None:
26
+ pass
@@ -0,0 +1,17 @@
1
+ from graphdatascience.arrow_client.arrow_base_model import ArrowBaseModel
2
+
3
+
4
+ class JobIdConfig(ArrowBaseModel):
5
+ job_id: str
6
+
7
+
8
+ class JobStatus(ArrowBaseModel):
9
+ job_id: str
10
+ status: str
11
+ progress: float
12
+
13
+
14
+ class MutateResult(ArrowBaseModel):
15
+ mutate_millis: int
16
+ node_properties_written: int
17
+ relationships_written: int
@@ -0,0 +1,19 @@
1
+ import json
2
+ from typing import Any, Iterator
3
+
4
+ from pyarrow._flight import Result
5
+
6
+
7
+ def deserialize_single(input_stream: Iterator[Result]) -> dict[str, Any]:
8
+ rows = deserialize(input_stream)
9
+ if len(rows) != 1:
10
+ raise ValueError(f"Expected exactly one result, got {len(rows)}")
11
+
12
+ return rows[0]
13
+
14
+
15
+ def deserialize(input_stream: Iterator[Result]) -> list[dict[str, Any]]:
16
+ def deserialize_row(row: Result): # type:ignore
17
+ return json.loads(row.body.to_pybytes().decode())
18
+
19
+ return [deserialize_row(row) for row in list(input_stream)]
@@ -0,0 +1,58 @@
1
+ import json
2
+ from typing import Any
3
+
4
+ from pandas import ArrowDtype, DataFrame
5
+ from pyarrow._flight import Ticket
6
+
7
+ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
8
+ from graphdatascience.arrow_client.v2.api_types import JobIdConfig, JobStatus
9
+ from graphdatascience.arrow_client.v2.data_mapper_utils import deserialize_single
10
+
11
+ JOB_STATUS_ENDPOINT = "v2/jobs.status"
12
+ RESULTS_SUMMARY_ENDPOINT = "v2/results.summary"
13
+
14
+
15
+ class JobClient:
16
+ @staticmethod
17
+ def run_job_and_wait(client: AuthenticatedArrowClient, endpoint: str, config: dict[str, Any]) -> str:
18
+ job_id = JobClient.run_job(client, endpoint, config)
19
+ JobClient.wait_for_job(client, job_id)
20
+ return job_id
21
+
22
+ @staticmethod
23
+ def run_job(client: AuthenticatedArrowClient, endpoint: str, config: dict[str, Any]) -> str:
24
+ res = client.do_action_with_retry(endpoint, config)
25
+
26
+ single = deserialize_single(res)
27
+ return JobIdConfig(**single).job_id
28
+
29
+ @staticmethod
30
+ def wait_for_job(client: AuthenticatedArrowClient, job_id: str) -> None:
31
+ while True:
32
+ arrow_res = client.do_action_with_retry(JOB_STATUS_ENDPOINT, JobIdConfig(jobId=job_id).dump_camel())
33
+ job_status = JobStatus(**deserialize_single(arrow_res))
34
+ if job_status.status == "Done":
35
+ break
36
+
37
+ @staticmethod
38
+ def get_summary(client: AuthenticatedArrowClient, job_id: str) -> dict[str, Any]:
39
+ res = client.do_action_with_retry(RESULTS_SUMMARY_ENDPOINT, JobIdConfig(jobId=job_id).dump_camel())
40
+ return deserialize_single(res)
41
+
42
+ @staticmethod
43
+ def stream_results(client: AuthenticatedArrowClient, graph_name: str, job_id: str) -> DataFrame:
44
+ payload = {
45
+ "graphName": graph_name,
46
+ "jobId": job_id,
47
+ }
48
+
49
+ res = client.do_action_with_retry("v2/results.stream", payload)
50
+ export_job_id = JobIdConfig(**deserialize_single(res)).job_id
51
+
52
+ stream_payload = {"version": "v2", "name": export_job_id, "body": {}}
53
+
54
+ ticket = Ticket(json.dumps(stream_payload).encode("utf-8"))
55
+
56
+ get = client.get_stream(ticket)
57
+ arrow_table = get.read_all()
58
+ return arrow_table.to_pandas(types_mapper=ArrowDtype) # type: ignore
@@ -0,0 +1,18 @@
1
+ import math
2
+ import time
3
+
4
+ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
5
+ from graphdatascience.arrow_client.v2.api_types import MutateResult
6
+ from graphdatascience.arrow_client.v2.data_mapper_utils import deserialize_single
7
+
8
+
9
+ class MutationClient:
10
+ MUTATE_ENDPOINT = "v2/results.mutate"
11
+
12
+ @staticmethod
13
+ def mutate_node_property(client: AuthenticatedArrowClient, job_id: str, mutate_property: str) -> MutateResult:
14
+ mutate_config = {"jobId": job_id, "mutateProperty": mutate_property}
15
+ start_time = time.time()
16
+ mutate_arrow_res = client.do_action_with_retry(MutationClient.MUTATE_ENDPOINT, mutate_config)
17
+ mutate_millis = math.ceil((time.time() - start_time) * 1000)
18
+ return MutateResult(mutateMillis=mutate_millis, **deserialize_single(mutate_arrow_res))
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+
3
+ import time
4
+ from typing import Any, Optional
5
+
6
+ from graphdatascience import QueryRunner
7
+ from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
8
+ from graphdatascience.call_parameters import CallParameters
9
+ from graphdatascience.procedure_surface.api.base_result import BaseResult
10
+ from graphdatascience.query_runner.protocol.write_protocols import WriteProtocol
11
+ from graphdatascience.query_runner.termination_flag import TerminationFlagNoop
12
+ from graphdatascience.session.dbms.protocol_resolver import ProtocolVersionResolver
13
+
14
+
15
+ class RemoteWriteBackClient:
16
+ def __init__(self, arrow_client: AuthenticatedArrowClient, query_runner: QueryRunner):
17
+ self._arrow_client = arrow_client
18
+ self._query_runner = query_runner
19
+
20
+ protocol_version = ProtocolVersionResolver(query_runner).resolve()
21
+ self._write_protocol = WriteProtocol.select(protocol_version)
22
+
23
+ # TODO: Add progress logging
24
+ def write(
25
+ self,
26
+ graph_name: str,
27
+ job_id: str,
28
+ concurrency: Optional[int] = None,
29
+ property_overwrites: Optional[dict[str, str]] = None,
30
+ relationship_type_overwrite: Optional[str] = None,
31
+ ) -> WriteBackResult:
32
+ arrow_config = self._arrow_configuration()
33
+
34
+ configuration: dict[str, Any] = {}
35
+ if concurrency is not None:
36
+ configuration["concurrency"] = concurrency
37
+ if property_overwrites is not None:
38
+ configuration["writeProperties"] = property_overwrites
39
+ if relationship_type_overwrite is not None:
40
+ configuration["writeRelationshipType"] = relationship_type_overwrite
41
+
42
+ write_back_params = CallParameters(
43
+ graphName=graph_name,
44
+ jobId=job_id,
45
+ arrowConfiguration=arrow_config,
46
+ configuration=configuration,
47
+ )
48
+
49
+ start_time = time.time()
50
+
51
+ result = self._write_protocol.run_write_back(
52
+ self._query_runner, write_back_params, None, TerminationFlagNoop()
53
+ ).squeeze()
54
+ write_millis = int((time.time() - start_time) * 1000)
55
+
56
+ return WriteBackResult(writeMillis=write_millis, **result.squeeze())
57
+
58
+ def _arrow_configuration(self) -> dict[str, Any]:
59
+ connection_info = self._arrow_client.advertised_connection_info()
60
+ token = self._arrow_client.request_token()
61
+ if token is None:
62
+ token = "IGNORED"
63
+ arrow_config = {
64
+ "host": connection_info.host,
65
+ "port": connection_info.port,
66
+ "token": token,
67
+ "encrypted": connection_info.encrypted,
68
+ }
69
+
70
+ return arrow_config
71
+
72
+
73
+ class WriteBackResult(BaseResult):
74
+ written_node_properties: int
75
+ written_node_labels: int
76
+ written_relationships: int
77
+ write_millis: int
78
+ status: str
79
+ progress: float
@@ -6,6 +6,8 @@ from typing import Any, Optional
6
6
 
7
7
  from pandas import Series
8
8
 
9
+ from graphdatascience.query_runner.query_mode import QueryMode
10
+
9
11
  from ..caller_base import CallerBase
10
12
  from ..query_runner.query_runner import QueryRunner
11
13
  from ..server_version.server_version import ServerVersion
@@ -46,7 +48,7 @@ class GraphCypherRunner(CallerBase):
46
48
  GraphCypherRunner._verify_query_ends_with_return_clause(self._namespace, query)
47
49
 
48
50
  result: Optional[dict[str, Any]] = self._query_runner.run_retryable_cypher(
49
- query, params, database, custom_error=False
51
+ query, params, database, custom_error=False, mode=QueryMode.READ
50
52
  ).squeeze()
51
53
 
52
54
  if not result:
@@ -5,6 +5,8 @@ from warnings import filterwarnings
5
5
  import pandas as pd
6
6
  from pandas import DataFrame, Series
7
7
 
8
+ from graphdatascience.query_runner.query_mode import QueryMode
9
+
8
10
  from ..call_parameters import CallParameters
9
11
  from ..error.cypher_warning_handler import (
10
12
  filter_id_func_deprecation_warning,
@@ -164,7 +166,9 @@ class GraphNodePropertiesRunner(GraphEntityOpsBaseRunner):
164
166
  unique_node_ids = result["nodeId"].drop_duplicates().tolist()
165
167
 
166
168
  db_properties_df = query_runner.run_retryable_cypher(
167
- GraphNodePropertiesRunner._build_query(db_node_properties), params={"ids": unique_node_ids}
169
+ GraphNodePropertiesRunner._build_query(db_node_properties),
170
+ params={"ids": unique_node_ids},
171
+ mode=QueryMode.READ,
168
172
  )
169
173
 
170
174
  if "propertyValue" not in result.keys():
@@ -68,7 +68,7 @@ class Graph:
68
68
  """
69
69
  return self._graph_info(["database"]) # type: ignore
70
70
 
71
- def configuration(self) -> "Series[Any]":
71
+ def configuration(self) -> Series[Any]:
72
72
  """
73
73
  Returns:
74
74
  the configuration of the graph