gs_interactive.QueryServiceApi¶
所有URI均相对于{INTERACTIVE_ADMIN_ENDPOINT}
尽管Interactive在存储层面支持多图,但查询服务目前只能运行在单个图上。这意味着在任何给定时间,只有一张图能提供查询服务。如果您尝试向当前未运行的图提交查询,系统将直接抛出错误。
方法 |
HTTP请求 |
描述 |
|---|---|---|
POST /v1/graph/{graph_id}/query |
向指定图ID标识的图提交查询 |
|
POST /v1/graph/current/query |
向当前运行的图提交查询 |
调用过程¶
结果[CollectiveResults] call_procedure(graph_id, params)
向指定图提交过程调用查询。查询的输出格式由results.proto定义。
关于存储过程的创建,请参考CypherStoredProcedure和CppStoredProcedure。
示例¶
# create graph..
# create procedure
req = QueryRequest(
query_name=proc_id,
arguments=[
TypedValue(
type=GSDataType(
PrimitiveType(primitive_type="DT_SIGNED_INT32")
),
value = 1
)
]
)
resp = sess.call_procedure(graph_id = graph_id, params = req)
assert resp.is_ok()
print("call procedure result: ", resp.get_value())
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
params |
QueryRequest |
[可选] |
返回类型¶
结果[CollectiveResults]
HTTP请求头¶
内容类型: text/plain
Accept: text/plain
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功执行。如果失败则为空? |
- |
500 |
服务器内部错误 |
- |
在当前图上调用过程¶
结果[CollectiveResults] call_procedure_current(params)
在运行的图上执行查询
向运行中的图提交查询。
示例¶
# create graph..
# create procedure
req = QueryRequest(
query_name=proc_id,
arguments=[
TypedValue(
type=GSDataType(
PrimitiveType(primitive_type="DT_SIGNED_INT32")
),
value = 1
)
]
)
resp = sess.call_procedure(params = req)
assert resp.is_ok()
print("call procedure result: ", resp.get_value())
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
请求体 |
QueryRequest |
[可选] |
返回类型¶
结果[CollectiveResults]
授权¶
无需授权
HTTP请求头¶
内容类型: text/plain
Accept: text/plain
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功执行。如果失败则为空? |
- |
500 |
服务器内部错误 |
- |