MCPcopy Create free account
hub / github.com/alibaba/GraphScope / interactive

Method interactive

python/graphscope/client/session.py:1173–1222  ·  view source on GitHub ↗

Get an interactive engine handler to execute gremlin and cypher queries. It will return an instance of :class:`graphscope.interactive.query.InteractiveQuery`, .. code:: python >>> # close and recreate InteractiveQuery. >>> interactive_query = sess.interacti

(self, graph, params=None, with_cypher=False)

Source from the content-addressed store, hash-verified

1171 return self.interactive(graph, params)
1172
1173 def interactive(self, graph, params=None, with_cypher=False):
1174 """Get an interactive engine handler to execute gremlin and cypher queries.
1175
1176 It will return an instance of :class:`graphscope.interactive.query.InteractiveQuery`,
1177
1178 .. code:: python
1179
1180 >>> # close and recreate InteractiveQuery.
1181 >>> interactive_query = sess.interactive(g)
1182 >>> interactive_query.close()
1183 >>> interactive_query = sess.interactive(g)
1184
1185 Args:
1186 graph (:class:`graphscope.framework.graph.GraphDAGNode`):
1187 The graph to create interactive instance.
1188 params: A dict consists of configurations of GIE instance.
1189
1190 Raises:
1191 InvalidArgumentError:
1192 - :code:`graph` is not a property graph.
1193
1194 Returns:
1195 :class:`graphscope.interactive.query.InteractiveQuery`:
1196 InteractiveQuery to execute gremlin and cypher queries.
1197 """
1198 if self._session_id != graph.session_id:
1199 raise RuntimeError(
1200 "Failed to create interactive engine on the graph with different session: {0} vs {1}".format(
1201 self._session_id, graph.session_id
1202 )
1203 )
1204
1205 if not graph.graph_type == graph_def_pb2.ARROW_PROPERTY:
1206 raise InvalidArgumentError("The graph should be a property graph.")
1207
1208 if not isinstance(graph, Graph): # Is a GraphDAGNode
1209 graph = self.run(graph)
1210
1211 object_id = graph.vineyard_id
1212 schema_path = graph.schema_path
1213 (
1214 gremlin_endpoint,
1215 cypher_endpoint,
1216 ) = self._grpc_client.create_interactive_instance(
1217 object_id, schema_path, params, with_cypher
1218 )
1219 interactive_query = InteractiveQuery(graph, gremlin_endpoint, cypher_endpoint)
1220 self._interactive_instance_dict[object_id] = interactive_query
1221 graph._attach_interactive_instance(interactive_query)
1222 return interactive_query
1223
1224 @deprecated("Please use `graphlearn` instead.")
1225 def learning(self, graph, nodes=None, edges=None, gen_labels=None):

Callers 4

gremlinMethod · 0.95
interactiveFunction · 0.80
query_to_cypherFunction · 0.80
test_cypher_endpointFunction · 0.80

Calls 6

runMethod · 0.95
InteractiveQueryClass · 0.90
formatMethod · 0.45

Tested by 1

test_cypher_endpointFunction · 0.64