Session¶
Session Interface¶
DefaultSession Class¶
- class gs_interactive.client.session.DefaultSession(admin_uri: str, stored_proc_uri: str | None = None)[source]¶
The default session implementation for Interactive SDK. It provides the implementation of all service APIs.
- __init__(admin_uri: str, stored_proc_uri: str | None = None)[source]¶
Construct a new session using the specified admin_uri and stored_proc_uri.
- Parameters:
admin_uri (str) – the uri for the admin service.
stored_proc_uri (str, optional) – the uri for the stored procedure service. If not provided,the uri will be read from the service status.
- add_edge(graph_id: str[str], edge_request: List[EdgeRequest]) Result[str] [source]¶
Add an edge to the specified graph.
- add_vertex(graph_id: str[str], vertex_edge_request: VertexEdgeRequest) Result[str[str]] [source]¶
Add a vertex to the specified graph.
- bulk_loading(graph_id: str[str], schema_mapping: SchemaMapping) Result[JobResponse] [source]¶
Submit a bulk loading job to the specified graph.
- call_procedure(graph_id: str[str], params: QueryRequest) Result[CollectiveResults] [source]¶
Call a procedure in the specified graph.
- call_procedure_current(params: QueryRequest) Result[CollectiveResults] [source]¶
Call a procedure in the current graph.
- call_procedure_current_raw(params: bytes) Result[str] [source]¶
Call a procedure in the current graph with raw bytes.
- call_procedure_raw(graph_id: str[str], params: bytes) Result[str] [source]¶
Call a procedure in the specified graph with raw bytes.
- create_graph(graph: CreateGraphRequest) Result[CreateGraphResponse] [source]¶
Create a new graph with the specified graph request.
- create_procedure(graph_id: str[str], procedure: CreateProcedureRequest) Result[CreateProcedureResponse] [source]¶
Create a new procedure in the specified graph.
- delete_procedure(graph_id: str[str], procedure_id: str[str]) Result[str] [source]¶
Delete a procedure in the specified graph.
- ensure_param_str(param_name: str, param)[source]¶
Ensure the param is a string, otherwise raise an exception
- get_edge(graph_id: str[str], edge_label: str[str], src_label: str[str], src_primary_key_value: Any[Any], dst_label: str[str], dst_primary_key_value: Any[Any]) Result[None | EdgeRequest] [source]¶
Get an edge from the specified graph with primary key value.
- get_graph_meta(graph_id: str[str]) Result[GetGraphResponse] [source]¶
Get the meta information of a specified graph.
- get_graph_schema(graph_id: str[str]) Result[GetGraphSchemaResponse] [source]¶
Get the schema of a specified graph.
- Parameters:
graph_id (str) – The ID of the graph whose schema is to be retrieved.
- Returns:
- The result containing the schema of
the specified graph.
- Return type:
Result[GetGraphSchemaResponse]
- get_graph_statistics(graph_id: str[str]) Result[GetGraphStatisticsResponse] [source]¶
Get the statistics of a specified graph.
- get_job(job_id: str[str]) Result[JobStatus] [source]¶
Get the status of a job with the specified job id.
- get_procedure(graph_id: str[str], procedure_id: str[str]) Result[GetProcedureResponse] [source]¶
Get a procedure in the specified graph.
- get_vertex(graph_id: str[str], label: str[str], primary_key_value: Any[Any]) Result[VertexData] [source]¶
Get a vertex from the specified graph with primary key value.
- list_procedures(graph_id: str[str]) Result[List[GetProcedureResponse]] [source]¶
List all procedures in the specified graph.
- start_service(start_service_request: StartServiceRequest | None[StartServiceRequest | None] | None = None) Result[str] [source]¶
Start the service on a specified graph.
- try_upload_files(schema_mapping: SchemaMapping) Result[SchemaMapping] [source]¶
Try to upload the input files if they are specified with a starting @ for input files in schema_mapping. Replace the path to the uploaded file with the path returned from the server.
The @ can be added to the beginning of data_source.location in schema_mapping.loading_config,or added to each file in vertex_mappings and edge_mappings.
- location: @/path/to/dir
- inputs:
@/path/to/file1
@/path/to/file2
- location: /path/to/dir
- inputs:
@/path/to/file1
@/path/to/file2
- location: @/path/to/dir
- inputs:
/path/to/file1
/path/to/file2
- location: /path/to/dir
- inputs:
/path/to/file1
/path/to/file2
- location: None
- inputs:
@/path/to/file1
@/path/to/file2
Among the above 4 cases, only the 1, 3, 5 case are valid, for 2,4 the file will not be uploaded
- update_edge(graph_id: str[str], edge_request: EdgeRequest) Result[str] [source]¶
Update an edge in the specified graph.
- update_procedure(graph_id: str[str], proc_id: str[str], procedure: UpdateProcedureRequest) Result[str] [source]¶
Update a procedure in the specified graph.
- update_vertex(graph_id: str[str], vertex_request: VertexRequest) Result[str] [source]¶
Update a vertex in the specified graph.