@@ -1411,8 +1411,11 @@ def opencypher_status(self, line='', local_ns: dict = None):
14111411 @line_magic
14121412 @needs_local_scope
14131413 @display_exceptions
1414- @neptune_db_only
14151414 def status (self , line = '' , local_ns : dict = None ):
1415+ if self .client .is_analytics_domain ():
1416+ logger .info (f'Redirected %status call to %get_graph.' )
1417+ self .get_graph (line , local_ns )
1418+ return
14161419 logger .info (f'calling for status on endpoint { self .graph_notebook_config .host } ' )
14171420 parser = argparse .ArgumentParser ()
14181421 parser .add_argument ('--silent' , action = 'store_true' , default = False , help = "Display no output." )
@@ -1439,6 +1442,33 @@ def status(self, line='', local_ns: dict = None):
14391442 print ()
14401443 return status_res
14411444
1445+ @line_magic
1446+ @needs_local_scope
1447+ @display_exceptions
1448+ @neptune_graph_only
1449+ def get_graph (self , line = '' , local_ns : dict = None ):
1450+ logger .info (f'calling for status on endpoint { self .graph_notebook_config .host } ' )
1451+ parser = argparse .ArgumentParser ()
1452+ parser .add_argument ('--include-metadata' , action = 'store_true' , default = False ,
1453+ help = "Display the response metadata if it is available." )
1454+ parser .add_argument ('--silent' , action = 'store_true' , default = False , help = "Display no output." )
1455+ parser .add_argument ('--store-to' , type = str , default = '' , help = 'store query result to this variable' )
1456+ args = parser .parse_args (line .split ())
1457+
1458+ try :
1459+ graph_id = self .client .get_graph_id ()
1460+ res = self .client .get_graph (graph_id = graph_id )
1461+ if not args .include_metadata :
1462+ res .pop ('ResponseMetadata' , None )
1463+ if not args .silent :
1464+ print (json .dumps (res , indent = 2 , default = str ))
1465+ store_to_ns (args .store_to , res , local_ns )
1466+ except Exception as e :
1467+ if not args .silent :
1468+ print ("Encountered an error when attempting to retrieve graph status:\n " )
1469+ print (e )
1470+ store_to_ns (args .store_to , e , local_ns )
1471+
14421472 @line_magic
14431473 @needs_local_scope
14441474 @display_exceptions
0 commit comments