mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-28 01:46:22 +02:00
Updated utils to have command line
This commit is contained in:
parent
603ad4e38f
commit
da94865fb5
3 changed files with 175 additions and 36 deletions
|
|
@ -1,10 +1,45 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Connects to the trustgraph graph hosts and dumps all graph edges.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import time
|
||||
|
||||
from trustgraph.trustgraph import TrustGraph
|
||||
|
||||
t = TrustGraph()
|
||||
def show_graph(graph_hosts):
|
||||
|
||||
rows = t.get_all(limit=100_000_000)
|
||||
for s, p, o in rows:
|
||||
print(s, p, o)
|
||||
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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue