@@ -1411,8 +1411,11 @@ def opencypher_status(self, line='', local_ns: dict = None):
1411
1411
@line_magic
1412
1412
@needs_local_scope
1413
1413
@display_exceptions
1414
- @neptune_db_only
1415
1414
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
1416
1419
logger .info (f'calling for status on endpoint { self .graph_notebook_config .host } ' )
1417
1420
parser = argparse .ArgumentParser ()
1418
1421
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):
1439
1442
print ()
1440
1443
return status_res
1441
1444
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
+
1442
1472
@line_magic
1443
1473
@needs_local_scope
1444
1474
@display_exceptions
0 commit comments