in src/graph_notebook/magics/graph_magic.py [0:0]
def summary(self, line, local_ns: dict = None):
parser = argparse.ArgumentParser()
parser.add_argument('language', nargs='?', type=str.lower, default="propertygraph",
help=f'The language endpoint to use. Valid inputs: {STATISTICS_LANGUAGE_INPUTS}. '
f'Default: propertygraph.',
choices=STATISTICS_LANGUAGE_INPUTS)
parser.add_argument('--detailed', action='store_true', default=False,
help="Toggles the display of structures fields on or off in the output. If not supplied, "
"we will default to the basic summary display mode.")
parser.add_argument('--silent', action='store_true', default=False, help="Display no output.")
parser.add_argument('--store-to', type=str, default='')
args = parser.parse_args(line.split())
if args.detailed:
mode = "detailed"
else:
mode = "basic"
language_ep = args.language
if self.client.is_analytics_domain():
is_analytics = True
if language_ep in STATISTICS_LANGUAGE_INPUTS_SPARQL:
print("SPARQL is not supported for Neptune Analytics, defaulting to PropertyGraph.")
language_ep = 'propertygraph'
else:
is_analytics = False
summary_res = self.client.statistics(language_ep, True, mode, is_analytics)
if summary_res.status_code == 400:
retry_legacy = process_statistics_400(summary_res, is_summary=True, is_analytics=is_analytics)
if retry_legacy == 1:
summary_res = self.client.statistics(language_ep, True, mode, False)
else:
return
summary_res.raise_for_status()
summary_res_json = summary_res.json()
if not args.silent:
print(json.dumps(summary_res_json, indent=2))
store_to_ns(args.store_to, summary_res_json, local_ns)