trustgraph/scripts/graph-show
2024-07-12 15:06:51 +01:00

45 lines
771 B
Python
Executable file

#!/usr/bin/env python3
"""
Connects to the trustgraph graph hosts and dumps all graph edges.
"""
import argparse
import time
from trustgraph.trustgraph import TrustGraph
def show_graph(graph_hosts):
t = TrustGraph(hosts=graph_hosts)
rows = t.get_all(limit=100_000_000)
for s, p, o in rows:
print(s, p, o)
def main():
parser = argparse.ArgumentParser(
prog='graph-show',
description=__doc__,
)
parser.add_argument(
'-g', '--graph-hosts',
default="localhost",
help=f'Graph host (default: localhost)',
)
args = parser.parse_args()
try:
show_graph(graph_hosts=args.graph_hosts.split(","))
except Exception as e:
print("Exception:", e, flush=True)
main()