TuGraph Python SDK

This document is the usage instruction of TuGraph Python SDK

1.Overview

Python’s TuGraph Rpc Client is a CPP Client SDK packaged with pybind11, so its interface details are not detailed in this document. This document only explains the use of TuGraph Python Restful Client SDK, including executing stored procedures, calling Cypher, and other operations.

2.Demo

2.1.Call cypher

TuGraphClient import TuGraphClient

client = TuGraphClient("127.0.0.1:7071" , "admin", "73@TuGraph")
cypher = "match (n) return properties(n) limit 1"
res = client.call_cypher(cypher)
print(res)

2.2.Call stored procedure

TuGraphClient import TuGraphClient

client = TuGraphClient("127.0.0.1:7071" , "admin", "73@TuGraph")
plugin_type = "cpp"
plugin_name = "khop"
plugin_input = "{\"root\": 10, \"hop\": 3}"
res = client.call_plugin(plugin_type, plguin_name, plugin_input)
print(res)