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.
- graphdatascience/__init__.py +7 -30
- graphdatascience/arrow_client/arrow_authentication.py +2 -0
- graphdatascience/arrow_client/arrow_endpoint_version.py +19 -10
- graphdatascience/arrow_client/arrow_info.py +19 -8
- graphdatascience/arrow_client/arrow_table_utils.py +38 -0
- graphdatascience/arrow_client/authenticated_flight_client.py +121 -76
- graphdatascience/arrow_client/server_health_check.py +12 -0
- graphdatascience/arrow_client/v1/gds_arrow_client.py +52 -53
- graphdatascience/arrow_client/v2/api_types.py +2 -0
- graphdatascience/arrow_client/v2/gds_arrow_client.py +31 -30
- graphdatascience/arrow_client/v2/job_client.py +34 -8
- graphdatascience/datasets/graph_constructor_func.py +2 -2
- graphdatascience/datasets/nx_loader.py +3 -3
- graphdatascience/datasets/ogb_loader.py +5 -5
- graphdatascience/datasets/simple_file_loader.py +0 -11
- graphdatascience/error/cypher_warning_handler.py +6 -3
- graphdatascience/error/not_available_outside_aura.py +5 -0
- graphdatascience/error/standalone_session_error.py +3 -0
- graphdatascience/graph/__init__.py +3 -0
- graphdatascience/graph/{v2/graph_api.py → graph_api.py} +56 -24
- graphdatascience/graph/{v2/graph_backend.py → graph_backend.py} +1 -1
- graphdatascience/{procedure_surface/api/catalog → graph}/graph_info.py +9 -0
- graphdatascience/{query_runner/arrow_graph_constructor.py → graph_construction/arrow_v1_graph_constructor.py} +14 -34
- graphdatascience/graph_construction/arrow_v2_graph_constructor.py +102 -0
- graphdatascience/{query_runner → graph_construction}/cypher_graph_constructor.py +33 -146
- graphdatascience/graph_data_science.py +731 -174
- graphdatascience/ignored_server_endpoints.py +0 -6
- graphdatascience/model/model.py +62 -235
- graphdatascience/model/model_catalog_protocol.py +29 -0
- graphdatascience/model/{v2/model_details.py → model_details.py} +1 -1
- graphdatascience/procedure_surface/__init__.py +0 -3
- graphdatascience/procedure_surface/api/base_result.py +19 -1
- graphdatascience/procedure_surface/api/catalog/__init__.py +20 -5
- graphdatascience/procedure_surface/api/catalog/catalog_endpoints.py +96 -40
- graphdatascience/procedure_surface/api/catalog/dataset_endpoints.py +22 -14
- graphdatascience/procedure_surface/api/catalog/graph_export_endpoints.py +142 -0
- graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py +31 -23
- graphdatascience/procedure_surface/api/catalog/node_label_endpoints.py +7 -13
- graphdatascience/procedure_surface/api/catalog/node_properties_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/catalog/node_property_endpoints.py +74 -0
- graphdatascience/procedure_surface/api/catalog/relationship_properties_endpoints.py +120 -0
- graphdatascience/procedure_surface/api/catalog/relationship_property_endpoints.py +65 -0
- graphdatascience/procedure_surface/api/catalog/relationships_data_frame.py +47 -0
- graphdatascience/procedure_surface/api/catalog/relationships_endpoints.py +28 -23
- graphdatascience/procedure_surface/api/catalog/scale_properties_endpoints.py +12 -12
- graphdatascience/procedure_surface/api/catalog/validation.py +17 -0
- graphdatascience/procedure_surface/api/centrality/__init__.py +10 -0
- graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py +19 -19
- graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py +10 -10
- graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py +17 -17
- graphdatascience/procedure_surface/api/centrality/bridges_endpoints.py +4 -4
- graphdatascience/procedure_surface/api/centrality/celf_endpoints.py +22 -22
- graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py +21 -12
- graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py +7 -7
- graphdatascience/procedure_surface/api/centrality/degree_endpoints.py +12 -12
- graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py +12 -12
- graphdatascience/procedure_surface/api/centrality/hits_endpoints.py +294 -0
- graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py +20 -20
- graphdatascience/procedure_surface/api/collapse_path_endpoints.py +5 -5
- graphdatascience/procedure_surface/api/community/clique_counting_endpoints.py +7 -7
- graphdatascience/procedure_surface/api/community/conductance_endpoints.py +3 -3
- graphdatascience/procedure_surface/api/community/hdbscan_endpoints.py +32 -32
- graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py +9 -9
- graphdatascience/procedure_surface/api/community/kcore_endpoints.py +8 -8
- graphdatascience/procedure_surface/api/community/kmeans_endpoints.py +27 -27
- graphdatascience/procedure_surface/api/community/labelpropagation_endpoints.py +12 -12
- graphdatascience/procedure_surface/api/community/leiden_endpoints.py +27 -27
- graphdatascience/procedure_surface/api/community/local_clustering_coefficient_endpoints.py +11 -11
- graphdatascience/procedure_surface/api/community/louvain_endpoints.py +18 -18
- graphdatascience/procedure_surface/api/community/maxkcut_endpoints.py +8 -8
- graphdatascience/procedure_surface/api/community/modularity_endpoints.py +5 -5
- graphdatascience/procedure_surface/api/community/modularity_optimization_endpoints.py +7 -7
- graphdatascience/procedure_surface/api/community/scc_endpoints.py +8 -8
- graphdatascience/procedure_surface/api/community/sllpa_endpoints.py +17 -17
- graphdatascience/procedure_surface/api/community/triangle_count_endpoints.py +17 -17
- graphdatascience/procedure_surface/api/community/triangles_endpoints.py +5 -5
- graphdatascience/procedure_surface/api/community/wcc_endpoints.py +15 -15
- graphdatascience/procedure_surface/api/config_endpoints.py +4 -4
- graphdatascience/procedure_surface/api/debug_endpoints.py +43 -0
- graphdatascience/procedure_surface/api/descriptions.py +3 -0
- graphdatascience/procedure_surface/api/estimation_result.py +3 -2
- graphdatascience/procedure_surface/api/job_handle.py +4 -4
- graphdatascience/procedure_surface/api/kge/__init__.py +17 -0
- graphdatascience/procedure_surface/api/kge/kge_endpoints.py +69 -0
- graphdatascience/procedure_surface/api/kge/kge_predict_endpoints.py +218 -0
- graphdatascience/procedure_surface/api/kge/simple_rel_embedding_model.py +227 -0
- graphdatascience/procedure_surface/api/license_endpoints.py +23 -0
- graphdatascience/procedure_surface/api/list_progress_endpoint.py +1 -1
- graphdatascience/procedure_surface/api/memory_endpoints.py +46 -0
- graphdatascience/procedure_surface/api/model/model_catalog_endpoints.py +4 -3
- graphdatascience/procedure_surface/api/node_embedding/__init__.py +28 -0
- graphdatascience/procedure_surface/api/node_embedding/config.py +81 -0
- graphdatascience/procedure_surface/api/node_embedding/embedding_endpoints.py +150 -0
- graphdatascience/procedure_surface/api/node_embedding/fastpath_endpoints.py +289 -0
- graphdatascience/procedure_surface/api/node_embedding/fastrp_endpoints.py +42 -42
- graphdatascience/procedure_surface/api/node_embedding/graphsage_endpoints.py +29 -22
- graphdatascience/procedure_surface/api/{model → node_embedding}/graphsage_model.py +27 -27
- graphdatascience/procedure_surface/api/node_embedding/graphsage_predict_endpoints.py +11 -11
- graphdatascience/procedure_surface/api/node_embedding/graphsage_train_endpoints.py +21 -21
- graphdatascience/procedure_surface/api/node_embedding/hashgnn_endpoints.py +38 -38
- graphdatascience/procedure_surface/api/node_embedding/node2vec_endpoints.py +62 -62
- graphdatascience/procedure_surface/api/pathfinding/__init__.py +2 -0
- graphdatascience/procedure_surface/api/pathfinding/all_shortest_path_endpoints.py +4 -4
- graphdatascience/procedure_surface/api/pathfinding/bfs_endpoints.py +10 -10
- graphdatascience/procedure_surface/api/pathfinding/dag_endpoints.py +7 -0
- graphdatascience/procedure_surface/api/pathfinding/dfs_endpoints.py +10 -10
- graphdatascience/procedure_surface/api/pathfinding/dijkstra_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/pathfinding/k_spanning_tree_endpoints.py +3 -3
- graphdatascience/procedure_surface/api/pathfinding/longest_path_endpoints.py +3 -3
- graphdatascience/procedure_surface/api/pathfinding/max_flow_endpoints.py +7 -7
- graphdatascience/procedure_surface/api/pathfinding/max_flow_min_cost_endpoints.py +7 -7
- graphdatascience/procedure_surface/api/pathfinding/prize_steiner_tree_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/pathfinding/random_walk_endpoints.py +6 -6
- graphdatascience/procedure_surface/api/pathfinding/single_source_bellman_ford_endpoints.py +12 -12
- graphdatascience/procedure_surface/api/pathfinding/single_source_delta_endpoints.py +15 -15
- graphdatascience/procedure_surface/api/pathfinding/single_source_dijkstra_endpoints.py +9 -9
- graphdatascience/procedure_surface/api/pathfinding/source_target_astar_endpoints.py +21 -21
- graphdatascience/procedure_surface/api/pathfinding/source_target_dijkstra_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/pathfinding/source_target_yens_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/pathfinding/spanning_tree_endpoints.py +13 -13
- graphdatascience/procedure_surface/api/pathfinding/steiner_tree_endpoints.py +23 -23
- graphdatascience/procedure_surface/api/pathfinding/topological_sort_endpoints.py +54 -0
- graphdatascience/procedure_surface/api/pipeline/__init__.py +4 -2
- graphdatascience/procedure_surface/api/{model → pipeline}/link_prediction_model.py +10 -10
- graphdatascience/procedure_surface/api/pipeline/link_prediction_pipeline.py +12 -6
- graphdatascience/procedure_surface/api/pipeline/link_prediction_pipeline_endpoints.py +20 -0
- graphdatascience/procedure_surface/api/pipeline/link_prediction_predict_endpoints.py +137 -4
- graphdatascience/procedure_surface/api/pipeline/link_prediction_train_endpoints.py +6 -6
- graphdatascience/procedure_surface/api/{model → pipeline}/node_classification_model.py +14 -12
- graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline.py +15 -7
- graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline_endpoints.py +20 -0
- graphdatascience/procedure_surface/api/pipeline/node_classification_pipeline_results.py +1 -0
- graphdatascience/procedure_surface/api/pipeline/node_classification_predict_endpoints.py +6 -6
- graphdatascience/procedure_surface/api/pipeline/node_classification_train_endpoints.py +6 -6
- graphdatascience/procedure_surface/api/{model → pipeline}/node_regression_model.py +10 -10
- graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline.py +11 -5
- graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_endpoints.py +28 -7
- graphdatascience/procedure_surface/api/pipeline/node_regression_pipeline_protocol.py +4 -4
- graphdatascience/procedure_surface/api/pipeline/node_regression_predict_endpoints.py +4 -4
- graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_protocol.py +12 -1
- graphdatascience/procedure_surface/api/pipeline/pipeline_catalog_result.py +19 -0
- graphdatascience/procedure_surface/api/pipeline/pipeline_endpoints.py +14 -15
- graphdatascience/procedure_surface/api/pipeline/pipeline_info_mapping.py +33 -0
- graphdatascience/procedure_surface/api/pipeline/pipeline_model.py +52 -0
- graphdatascience/procedure_surface/api/projection_job_handle.py +3 -3
- graphdatascience/procedure_surface/api/similarity/__init__.py +2 -0
- graphdatascience/procedure_surface/api/similarity/knn_endpoints.py +29 -29
- graphdatascience/procedure_surface/api/similarity/knn_filtered_endpoints.py +48 -48
- graphdatascience/procedure_surface/api/similarity/node_similarity_endpoints.py +43 -43
- graphdatascience/procedure_surface/api/similarity/node_similarity_filtered_endpoints.py +53 -53
- graphdatascience/procedure_surface/api/similarity/similarity_functions.py +186 -0
- graphdatascience/procedure_surface/api/topological_link_prediction_endpoints.py +187 -0
- graphdatascience/procedure_surface/api/util_endpoints.py +114 -0
- graphdatascience/procedure_surface/api/write_job_handle.py +8 -3
- graphdatascience/procedure_surface/api/write_protocol.py +34 -0
- graphdatascience/procedure_surface/arrow/catalog/__init__.py +6 -0
- graphdatascience/procedure_surface/arrow/catalog/catalog_arrow_endpoints.py +85 -344
- graphdatascience/procedure_surface/arrow/catalog/graph_backend_arrow.py +5 -4
- graphdatascience/procedure_surface/arrow/catalog/graph_export_arrow_endpoints.py +49 -0
- graphdatascience/procedure_surface/arrow/catalog/graph_ops_arrow.py +1 -1
- graphdatascience/procedure_surface/arrow/catalog/graph_sampling_arrow_endpoints.py +17 -4
- graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py +4 -8
- graphdatascience/procedure_surface/arrow/catalog/node_properties_arrow_endpoints.py +11 -8
- graphdatascience/procedure_surface/arrow/catalog/projection_arrow_endpoints.py +324 -0
- graphdatascience/procedure_surface/arrow/catalog/relationship_arrow_endpoints.py +15 -13
- graphdatascience/procedure_surface/arrow/catalog/scale_properties_arrow_endpoints.py +8 -11
- graphdatascience/procedure_surface/arrow/centrality/articlerank_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/articulationpoints_arrow_endpoints.py +19 -12
- graphdatascience/procedure_surface/arrow/centrality/betweenness_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/bridges_arrow_endpoints.py +5 -5
- graphdatascience/procedure_surface/arrow/centrality/celf_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/closeness_arrow_endpoints.py +19 -8
- graphdatascience/procedure_surface/arrow/centrality/closeness_harmonic_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/degree_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/eigenvector_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/centrality/hits_arrow_endpoints.py +253 -0
- graphdatascience/procedure_surface/arrow/centrality/pagerank_arrow_endpoints.py +11 -11
- graphdatascience/procedure_surface/arrow/collapse_path_arrow_endpoints.py +2 -2
- graphdatascience/procedure_surface/arrow/community/clique_counting_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/conductance_arrow_endpoints.py +4 -8
- graphdatascience/procedure_surface/arrow/community/hdbscan_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/k1coloring_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/kcore_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/kmeans_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/labelpropagation_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/leiden_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/local_clustering_coefficient_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/louvain_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/maxkcut_arrow_endpoints.py +6 -6
- graphdatascience/procedure_surface/arrow/community/modularity_arrow_endpoints.py +6 -8
- graphdatascience/procedure_surface/arrow/community/modularity_optimization_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/scc_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/sllpa_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/triangle_count_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/community/triangles_arrow_endpoints.py +2 -2
- graphdatascience/procedure_surface/arrow/community/wcc_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/endpoints_helper_base.py +20 -12
- graphdatascience/procedure_surface/arrow/jobs_arrow_endpoints.py +4 -4
- graphdatascience/procedure_surface/arrow/model/model_catalog_arrow_endpoints.py +1 -1
- graphdatascience/procedure_surface/arrow/node_embedding/embedding_arrow_endpoints.py +105 -0
- graphdatascience/procedure_surface/arrow/node_embedding/fastpath_arrow_endpoints.py +280 -0
- graphdatascience/procedure_surface/arrow/node_embedding/fastrp_arrow_endpoints.py +8 -8
- graphdatascience/procedure_surface/arrow/node_embedding/graphsage_predict_arrow_endpoints.py +7 -9
- graphdatascience/procedure_surface/arrow/node_embedding/graphsage_train_arrow_endpoints.py +10 -10
- graphdatascience/procedure_surface/arrow/node_embedding/hashgnn_arrow_endpoints.py +7 -7
- graphdatascience/procedure_surface/arrow/node_embedding/node2vec_arrow_endpoints.py +7 -7
- graphdatascience/procedure_surface/arrow/node_property_endpoints.py +2 -2
- graphdatascience/procedure_surface/arrow/pathfinding/all_shortest_path_arrow_endpoints.py +6 -9
- graphdatascience/procedure_surface/arrow/pathfinding/bfs_arrow_endpoints.py +9 -8
- graphdatascience/procedure_surface/arrow/pathfinding/dag_arrow_endpoints.py +9 -0
- graphdatascience/procedure_surface/arrow/pathfinding/dfs_arrow_endpoints.py +9 -8
- graphdatascience/procedure_surface/arrow/pathfinding/dijkstra_arrow_endpoints.py +8 -11
- graphdatascience/procedure_surface/arrow/pathfinding/k_spanning_tree_arrow_endpoints.py +4 -4
- graphdatascience/procedure_surface/arrow/pathfinding/longest_path_arrow_endpoints.py +4 -8
- graphdatascience/procedure_surface/arrow/pathfinding/max_flow_arrow_endpoints.py +9 -14
- graphdatascience/procedure_surface/arrow/pathfinding/max_flow_min_cost_arrow_endpoints.py +9 -14
- graphdatascience/procedure_surface/arrow/pathfinding/prize_steiner_tree_arrow_endpoints.py +9 -12
- graphdatascience/procedure_surface/arrow/pathfinding/random_walk_arrow_endpoints.py +7 -7
- graphdatascience/procedure_surface/arrow/pathfinding/shortest_path_arrow_endpoints.py +1 -1
- graphdatascience/procedure_surface/arrow/pathfinding/single_source_bellman_ford_arrow_endpoints.py +10 -10
- graphdatascience/procedure_surface/arrow/pathfinding/single_source_delta_arrow_endpoints.py +9 -13
- graphdatascience/procedure_surface/arrow/pathfinding/single_source_dijkstra_arrow_endpoints.py +8 -12
- graphdatascience/procedure_surface/arrow/pathfinding/source_target_astar_arrow_endpoints.py +8 -12
- graphdatascience/procedure_surface/arrow/pathfinding/source_target_dijkstra_arrow_endpoints.py +8 -11
- graphdatascience/procedure_surface/arrow/pathfinding/source_target_yens_arrow_endpoints.py +8 -12
- graphdatascience/procedure_surface/arrow/pathfinding/spanning_tree_arrow_endpoints.py +9 -12
- graphdatascience/procedure_surface/arrow/pathfinding/steiner_tree_arrow_endpoints.py +9 -12
- graphdatascience/procedure_surface/arrow/pathfinding/topological_sort_arrow_endpoints.py +47 -0
- graphdatascience/procedure_surface/arrow/pipeline/link_prediction_pipeline_arrow_endpoints.py +18 -9
- graphdatascience/procedure_surface/arrow/pipeline/link_prediction_predict_arrow_endpoints.py +10 -6
- graphdatascience/procedure_surface/arrow/pipeline/link_prediction_train_arrow_endpoints.py +10 -10
- graphdatascience/procedure_surface/arrow/pipeline/node_classification_pipeline_arrow_endpoints.py +18 -9
- graphdatascience/procedure_surface/arrow/pipeline/node_classification_predict_arrow_endpoints.py +6 -6
- graphdatascience/procedure_surface/arrow/pipeline/node_classification_train_arrow_endpoints.py +10 -10
- graphdatascience/procedure_surface/arrow/pipeline/node_regression_pipeline_arrow_endpoints.py +21 -13
- graphdatascience/procedure_surface/arrow/pipeline/node_regression_predict_arrow_endpoints.py +4 -4
- graphdatascience/procedure_surface/arrow/pipeline/pipeline_arrow_endpoints.py +1 -1
- graphdatascience/procedure_surface/arrow/pipeline/pipeline_catalog_arrow_endpoints.py +12 -6
- graphdatascience/procedure_surface/arrow/relationship_endpoints_helper.py +2 -2
- graphdatascience/procedure_surface/arrow/similarity/knn_arrow_endpoints.py +9 -13
- graphdatascience/procedure_surface/arrow/similarity/knn_filtered_arrow_endpoints.py +9 -13
- graphdatascience/procedure_surface/arrow/similarity/node_similarity_arrow_endpoints.py +16 -20
- graphdatascience/procedure_surface/arrow/similarity/node_similarity_filtered_arrow_endpoints.py +9 -13
- graphdatascience/procedure_surface/arrow/stream_result_mapper.py +47 -1
- graphdatascience/procedure_surface/arrow/util_arrow_endpoints.py +55 -0
- graphdatascience/procedure_surface/cypher/catalog/__init__.py +8 -0
- graphdatascience/procedure_surface/cypher/catalog/catalog_cypher_endpoints.py +107 -95
- graphdatascience/procedure_surface/cypher/catalog/graph_backend_cypher.py +39 -0
- graphdatascience/procedure_surface/cypher/catalog/graph_export_cypher_endpoints.py +97 -0
- graphdatascience/procedure_surface/cypher/catalog/graph_ops_cypher.py +55 -0
- graphdatascience/procedure_surface/cypher/catalog/graph_sampling_cypher_endpoints.py +22 -9
- graphdatascience/procedure_surface/cypher/catalog/node_label_cypher_endpoints.py +8 -18
- graphdatascience/procedure_surface/cypher/catalog/node_properties_cypher_endpoints.py +19 -11
- graphdatascience/procedure_surface/cypher/catalog/projection_cypher_endpoints.py +213 -0
- graphdatascience/procedure_surface/cypher/catalog/relationship_cypher_endpoints.py +41 -28
- graphdatascience/procedure_surface/cypher/catalog/scale_properties_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/catalog/utils.py +20 -0
- graphdatascience/procedure_surface/cypher/centrality/articlerank_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/articulationpoints_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/betweenness_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/bridges_cypher_endpoints.py +3 -3
- graphdatascience/procedure_surface/cypher/centrality/celf_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/closeness_cypher_endpoints.py +20 -12
- graphdatascience/procedure_surface/cypher/centrality/closeness_harmonic_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/degree_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/eigenvector_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/centrality/hits_cypher_endpoints.py +207 -0
- graphdatascience/procedure_surface/cypher/centrality/pagerank_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/collapse_path_cypher_endpoints.py +4 -4
- graphdatascience/procedure_surface/cypher/community/clique_counting_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/conductance_cypher_endpoints.py +2 -2
- graphdatascience/procedure_surface/cypher/community/hdbscan_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/community/k1coloring_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/kcore_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/kmeans_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/labelpropagation_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/leiden_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/local_clustering_coefficient_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/louvain_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/maxkcut_cypher_endpoints.py +6 -6
- graphdatascience/procedure_surface/cypher/community/modularity_cypher_endpoints.py +5 -5
- graphdatascience/procedure_surface/cypher/community/modularity_optimization_cypher_endpoints.py +9 -11
- graphdatascience/procedure_surface/cypher/community/scc_cypher_endpoints.py +14 -14
- graphdatascience/procedure_surface/cypher/community/sllpa_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/community/triangle_count_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/community/triangles_cypher_endpoints.py +2 -2
- graphdatascience/procedure_surface/cypher/community/wcc_cypher_endpoints.py +14 -14
- graphdatascience/procedure_surface/cypher/config_cypher_endpoints.py +2 -2
- graphdatascience/procedure_surface/cypher/debug_cypher_endpoints.py +15 -0
- graphdatascience/procedure_surface/cypher/estimation_utils.py +10 -10
- graphdatascience/procedure_surface/cypher/kge/__init__.py +5 -0
- graphdatascience/procedure_surface/cypher/kge/kge_predict_cypher_endpoints.py +148 -0
- graphdatascience/procedure_surface/cypher/license_cypher_endpoints.py +22 -0
- graphdatascience/procedure_surface/cypher/list_progress_cypher_endpoint.py +1 -1
- graphdatascience/procedure_surface/cypher/memory_cypher_endpoints.py +21 -0
- graphdatascience/procedure_surface/cypher/model/model_catalog_cypher_endpoints.py +24 -8
- graphdatascience/procedure_surface/cypher/node_embedding/fastrp_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/node_embedding/graphsage_predict_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/node_embedding/graphsage_train_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/node_embedding/hashgnn_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/node_embedding/node2vec_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/pathfinding/all_shortest_path_cypher_endpoints.py +3 -3
- graphdatascience/procedure_surface/cypher/pathfinding/bfs_cypher_endpoints.py +13 -13
- graphdatascience/procedure_surface/cypher/pathfinding/dag_cypher_endpoints.py +9 -0
- graphdatascience/procedure_surface/cypher/pathfinding/dfs_cypher_endpoints.py +13 -13
- graphdatascience/procedure_surface/cypher/pathfinding/dijkstra_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pathfinding/k_spanning_tree_cypher_endpoints.py +5 -5
- graphdatascience/procedure_surface/cypher/pathfinding/longest_path_cypher_endpoints.py +2 -2
- graphdatascience/procedure_surface/cypher/pathfinding/max_flow_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/pathfinding/max_flow_min_cost_cypher_endpoints.py +12 -12
- graphdatascience/procedure_surface/cypher/pathfinding/prize_steiner_tree_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/pathfinding/random_walk_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/pathfinding/single_source_bellman_ford_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/pathfinding/single_source_delta_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/pathfinding/single_source_dijkstra_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pathfinding/source_target_astar_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pathfinding/source_target_dijkstra_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pathfinding/source_target_yens_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pathfinding/spanning_tree_cypher_endpoints.py +15 -15
- graphdatascience/procedure_surface/cypher/pathfinding/steiner_tree_cypher_endpoints.py +11 -15
- graphdatascience/procedure_surface/cypher/pathfinding/topological_sort_cypher_endpoints.py +47 -0
- graphdatascience/procedure_surface/cypher/pipeline/link_prediction_pipeline_cypher_endpoints.py +32 -21
- graphdatascience/procedure_surface/cypher/pipeline/link_prediction_predict_cypher_endpoints.py +7 -7
- graphdatascience/procedure_surface/cypher/pipeline/link_prediction_train_cypher_endpoints.py +11 -11
- graphdatascience/procedure_surface/cypher/pipeline/node_classification_pipeline_cypher_endpoints.py +32 -21
- graphdatascience/procedure_surface/cypher/pipeline/node_classification_predict_cypher_endpoints.py +10 -10
- graphdatascience/procedure_surface/cypher/pipeline/node_classification_train_cypher_endpoints.py +11 -11
- graphdatascience/procedure_surface/cypher/pipeline/node_regression_pipeline_cypher_endpoints.py +37 -28
- graphdatascience/procedure_surface/cypher/pipeline/node_regression_predict_cypher_endpoints.py +5 -5
- graphdatascience/procedure_surface/cypher/pipeline/pipeline_catalog_cypher_endpoints.py +22 -8
- graphdatascience/procedure_surface/cypher/similarity/knn_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/similarity/knn_filtered_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/similarity/node_similarity_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/similarity/node_similarity_filtered_cypher_endpoints.py +9 -9
- graphdatascience/procedure_surface/cypher/topological_link_prediction_cypher_endpoints.py +138 -0
- graphdatascience/procedure_surface/cypher/util_cypher_endpoints.py +42 -0
- graphdatascience/procedure_surface/utils/node_matching.py +37 -0
- graphdatascience/procedure_surface/utils/result_utils.py +21 -0
- graphdatascience/{query_runner/progress → progress}/progress_bar.py +15 -4
- graphdatascience/{query_runner/progress → progress}/query_progress_logger.py +3 -9
- graphdatascience/{query_runner/progress → progress}/query_progress_provider.py +2 -11
- graphdatascience/query_runner/db_environment_resolver.py +2 -2
- graphdatascience/query_runner/neo4j_query_runner.py +40 -86
- graphdatascience/query_runner/query_runner.py +8 -11
- graphdatascience/query_runner/termination_flag.py +2 -0
- graphdatascience/retry_utils/neo4j_retry_helper.py +0 -3
- graphdatascience/retry_utils/retry_config.py +1 -1
- graphdatascience/session/aura_api.py +145 -12
- graphdatascience/session/aura_api_responses.py +27 -2
- graphdatascience/session/aura_api_token_authentication.py +1 -1
- graphdatascience/session/aura_graph_data_science.py +844 -156
- graphdatascience/session/dbms_connection_info.py +3 -1
- graphdatascience/session/endpoint_mappings.py +30 -0
- graphdatascience/session/gds_sessions.py +278 -30
- graphdatascience/{query_runner/protocol → session/remote_ops}/project_protocols.py +33 -23
- graphdatascience/{query_runner/protocol → session/remote_ops}/projection_runner.py +15 -4
- graphdatascience/{query_runner/protocol → session/remote_ops}/write_protocols.py +48 -46
- graphdatascience/session/session_info.py +7 -4
- graphdatascience/session/session_lifecycle_manager.py +59 -4
- graphdatascience/session/session_sizes.py +6 -2
- graphdatascience/version.py +2 -2
- graphdatascience/versions/__init__.py +4 -0
- {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/METADATA +63 -26
- graphdatascience-2.0.dist-info/RECORD +470 -0
- {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/WHEEL +1 -1
- graphdatascience/algo/algo_endpoints.py +0 -24
- graphdatascience/algo/algo_proc_runner.py +0 -45
- graphdatascience/algo/single_mode_algo_endpoints.py +0 -18
- graphdatascience/call_builder.py +0 -21
- graphdatascience/caller_base.py +0 -23
- graphdatascience/endpoints.py +0 -116
- graphdatascience/error/client_only_endpoint.py +0 -47
- graphdatascience/error/endpoint_suggester.py +0 -29
- graphdatascience/error/illegal_attr_checker.py +0 -16
- graphdatascience/error/uncallable_namespace.py +0 -16
- graphdatascience/graph/base_graph_proc_runner.py +0 -570
- graphdatascience/graph/graph_alpha_proc_runner.py +0 -81
- graphdatascience/graph/graph_beta_proc_runner.py +0 -43
- graphdatascience/graph/graph_create_result.py +0 -28
- graphdatascience/graph/graph_cypher_runner.py +0 -125
- graphdatascience/graph/graph_endpoints.py +0 -15
- graphdatascience/graph/graph_entity_ops_runner.py +0 -426
- graphdatascience/graph/graph_export_runner.py +0 -52
- graphdatascience/graph/graph_object.py +0 -232
- graphdatascience/graph/graph_proc_runner.py +0 -15
- graphdatascience/graph/graph_project_runner.py +0 -72
- graphdatascience/graph/graph_remote_proc_runner.py +0 -76
- graphdatascience/graph/graph_sample_runner.py +0 -72
- graphdatascience/graph/graph_type_check.py +0 -34
- graphdatascience/graph/nx_loader.py +0 -46
- graphdatascience/graph/ogb_loader.py +0 -76
- graphdatascience/graph/v2/__init__.py +0 -4
- graphdatascience/graph/v2/graph_backend_cypher.py +0 -54
- graphdatascience/model/graphsage_model.py +0 -56
- graphdatascience/model/link_prediction_model.py +0 -45
- graphdatascience/model/model_alpha_proc_runner.py +0 -51
- graphdatascience/model/model_beta_proc_runner.py +0 -33
- graphdatascience/model/model_endpoints.py +0 -22
- graphdatascience/model/model_proc_runner.py +0 -151
- graphdatascience/model/model_resolver.py +0 -21
- graphdatascience/model/node_classification_model.py +0 -78
- graphdatascience/model/node_regression_model.py +0 -25
- graphdatascience/model/pipeline_model.py +0 -104
- graphdatascience/model/simple_rel_embedding_model.py +0 -196
- graphdatascience/model/v2/model.py +0 -55
- graphdatascience/model/v2/model_api.py +0 -45
- graphdatascience/pipeline/classification_training_pipeline.py +0 -67
- graphdatascience/pipeline/lp_pipeline_create_runner.py +0 -20
- graphdatascience/pipeline/lp_training_pipeline.py +0 -52
- graphdatascience/pipeline/nc_pipeline_create_runner.py +0 -20
- graphdatascience/pipeline/nc_training_pipeline.py +0 -52
- graphdatascience/pipeline/nr_pipeline_create_runner.py +0 -20
- graphdatascience/pipeline/nr_training_pipeline.py +0 -83
- graphdatascience/pipeline/pipeline_alpha_proc_runner.py +0 -25
- graphdatascience/pipeline/pipeline_beta_proc_runner.py +0 -79
- graphdatascience/pipeline/pipeline_endpoints.py +0 -116
- graphdatascience/pipeline/pipeline_proc_runner.py +0 -88
- graphdatascience/pipeline/training_pipeline.py +0 -269
- graphdatascience/plugin_v2_endpoints.py +0 -540
- graphdatascience/procedure_surface/arrow/model_api_arrow.py +0 -57
- graphdatascience/procedure_surface/cypher/model_api_cypher.py +0 -49
- graphdatascience/query_runner/arrow_authentication/__init__.py +0 -3
- graphdatascience/query_runner/arrow_info/__init__.py +0 -5
- graphdatascience/query_runner/arrow_query_runner.py +0 -272
- graphdatascience/query_runner/gds_arrow_client.py +0 -1004
- graphdatascience/query_runner/progress/__init__.py +0 -0
- graphdatascience/query_runner/protocol/__init__.py +0 -0
- graphdatascience/query_runner/session_query_runner.py +0 -231
- graphdatascience/query_runner/standalone_session_query_runner.py +0 -109
- graphdatascience/semantic_version/__init__.py +0 -0
- graphdatascience/server_version/__init__.py +0 -0
- graphdatascience/server_version/compatible_with.py +0 -43
- graphdatascience/session/dedicated_sessions.py +0 -286
- graphdatascience/session/session_v2_endpoints.py +0 -593
- graphdatascience/system/__init__.py +0 -0
- graphdatascience/system/config_endpoints.py +0 -61
- graphdatascience/system/system_endpoints.py +0 -144
- graphdatascience/topological_lp/__init__.py +0 -0
- graphdatascience/topological_lp/topological_lp_alpha_endpoints.py +0 -8
- graphdatascience/topological_lp/topological_lp_alpha_runner.py +0 -52
- graphdatascience/topological_lp/topological_lp_runner.py +0 -72
- graphdatascience/utils/__init__.py +0 -0
- graphdatascience/utils/direct_util_endpoints.py +0 -115
- graphdatascience/utils/util_node_property_func_runner.py +0 -31
- graphdatascience/utils/util_proc_runner.py +0 -60
- graphdatascience/utils/util_remote_proc_runner.py +0 -55
- graphdatascience-1.22.dist-info/RECORD +0 -496
- /graphdatascience/{algo → graph_construction}/__init__.py +0 -0
- /graphdatascience/{query_runner → graph_construction}/graph_constructor.py +0 -0
- /graphdatascience/{model/v2 → progress}/__init__.py +0 -0
- /graphdatascience/{query_runner/progress → progress}/progress_provider.py +0 -0
- /graphdatascience/{query_runner/progress → progress}/static_progress_provider.py +0 -0
- /graphdatascience/{pipeline → session/remote_ops}/__init__.py +0 -0
- /graphdatascience/{query_runner/protocol → session/remote_ops}/arrow_config.py +0 -0
- /graphdatascience/{query_runner/protocol → session/remote_ops}/status.py +0 -0
- /graphdatascience/{semantic_version → versions}/semantic_version.py +0 -0
- /graphdatascience/{server_version → versions}/server_version.py +0 -0
- {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/licenses/LICENSE +0 -0
- {graphdatascience-1.22.dist-info → graphdatascience-2.0.dist-info}/top_level.txt +0 -0
graphdatascience/__init__.py
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
from .graph.
|
|
2
|
-
from .
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
5
|
-
from .
|
|
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
|
]
|
|
@@ -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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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(
|
|
29
|
+
raise UnsupportedArrowEndpointVersion(compatible_versions, supported_server_versions)
|
|
23
30
|
|
|
24
31
|
|
|
25
32
|
class UnsupportedArrowEndpointVersion(Exception):
|
|
26
|
-
def __init__(self,
|
|
27
|
-
super().__init__(
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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.
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
90
|
-
The host address of the GDS Arrow server
|
|
91
|
-
|
|
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
|
|
85
|
+
encrypted
|
|
96
86
|
A flag that indicates whether the connection should be encrypted (default is False)
|
|
97
|
-
arrow_client_options
|
|
98
|
-
Additional options
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
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 =
|
|
117
|
+
self._port = int(port)
|
|
118
|
+
self._auth = auth
|
|
109
119
|
self._encrypted = encrypted
|
|
110
|
-
self._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
|
|
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
|
|
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
|
|
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
|
+
...
|