Python SDK Reference

The Interactive Python SDK Reference is a comprehensive guide designed to assist developers in integrating the Interactive service into their Python applications. This SDK allows users to seamlessly connect to Interactive and harness its powerful features for graph management, stored procedure management, and query execution.

Requirements.

Python 3.7+

Installation & Usage

pip install

pip3 install graphscope-interactive

Then import the package:

import interactive_sdk

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import interactive_sdk

Tests

Execute pytest to run the tests.

Getting Started

First, install and start the interactive service via Interactive Getting Started, and you will get the endpoint for the Interactive service.

Interactive Service is listening at ${INTERACTIVE_ENDPOINT}.

Then, connect to the interactive endpoint, and try to run a simple query with following code.


from interactive_sdk.client.driver import Driver

# replace endpoint with the actual interactive endpoint, this is mock server just for testing.
interactive_endpoint='https://virtserver.swaggerhub.com/GRAPHSCOPE/interactive/1.0.0/'
driver = Driver(endpoint=interactive_endpoint)

# Interactive will initially start on a builtin modern graph. You can run a simple cypher query
with driver.getNeo4jSession() as session:
    resp = session.run('MATCH(n) RETURN COUNT(n);')
    for record in resp:
        print('record: ', record)
        # record:  <Record $f0=6>

For a more detailed example, please refer to Python SDK Example.

Documentation for Service APIs

All URIs are relative to ${INTERACTIVE_ENDPOINT}

Class

Method

HTTP request

Description

AdminServiceGraphManagementApi

create_dataloading_job

POST /v1/graph/{graph_id}/dataloading

AdminServiceGraphManagementApi

create_graph

POST /v1/graph

AdminServiceGraphManagementApi

delete_graph

DELETE /v1/graph/{graph_id}

AdminServiceGraphManagementApi

get_graph

GET /v1/graph/{graph_id}

AdminServiceGraphManagementApi

get_schema

GET /v1/graph/{graph_id}/schema

AdminServiceGraphManagementApi

list_graphs

GET /v1/graph

AdminServiceJobManagementApi

delete_job_by_id

DELETE /v1/job/{job_id}

AdminServiceJobManagementApi

get_job_by_id

GET /v1/job/{job_id}

AdminServiceJobManagementApi

list_jobs

GET /v1/job

AdminServiceProcedureManagementApi

create_procedure

POST /v1/graph/{graph_id}/procedure

AdminServiceProcedureManagementApi

delete_procedure

DELETE /v1/graph/{graph_id}/procedure/{procedure_id}

AdminServiceProcedureManagementApi

get_procedure

GET /v1/graph/{graph_id}/procedure/{procedure_id}

AdminServiceProcedureManagementApi

list_procedures

GET /v1/graph/{graph_id}/procedure

AdminServiceProcedureManagementApi

update_procedure

PUT /v1/graph/{graph_id}/procedure/{procedure_id}

AdminServiceServiceManagementApi

get_service_status

GET /v1/service/status

AdminServiceServiceManagementApi

restart_service

POST /v1/service/restart

AdminServiceServiceManagementApi

start_service

POST /v1/service/start

AdminServiceServiceManagementApi

stop_service

POST /v1/service/stop

GraphServiceEdgeManagementApi

add_edge

POST /v1/graph/{graph_id}/edge

Add edge to the graph

GraphServiceEdgeManagementApi

delete_edge

DELETE /v1/graph/{graph_id}/edge

Remove edge from the graph

GraphServiceEdgeManagementApi

get_edge

GET /v1/graph/{graph_id}/edge

Get the edge’s properties with src and dst vertex primary keys.

GraphServiceEdgeManagementApi

update_edge

PUT /v1/graph/{graph_id}/edge

Update edge’s property

GraphServiceVertexManagementApi

add_vertex

POST /v1/graph/{graph_id}/vertex

Add vertex to the graph

GraphServiceVertexManagementApi

delete_vertex

DELETE /v1/graph/{graph_id}/vertex

Remove vertex from the graph

GraphServiceVertexManagementApi

get_vertex

GET /v1/graph/{graph_id}/vertex

Get the vertex’s properties with vertex primary key.

GraphServiceVertexManagementApi

update_vertex

PUT /v1/graph/{graph_id}/vertex

Update vertex’s property

QueryServiceApi

proc_call

POST /v1/graph/{graph_id}/query

run queries on graph

Documentation for Data Structures

Documentation For Authorization

Authentication is not supported yet, and we will be introducing authorization-related implementation in the near future.