trustgraph/scripts/graph-show
Cyber MacGeddon 20f983eec9 - Change flawed _client timeout logic which was causing major lags
- Moved clients to trustgraph.clients to tidy the parent directory
- Version bump
2024-08-20 17:54:11 +01:00

46 lines
929 B
Python
Executable file

#!/usr/bin/env python3
"""
Connects to the graph query service and dumps all graph edges.
"""
import argparse
import os
from trustgraph.clients.triples_query_client import TriplesQueryClient
default_pulsar_host = os.getenv("PULSAR_HOST", 'pulsar://pulsar:6650')
def show_graph(pulsar):
tq = TriplesQueryClient(pulsar_host="pulsar://localhost:6650")
rows = tq.request(None, None, None, limit=10_000_000)
for row in rows:
print(row.s.value, row.p.value, row.o.value)
def main():
parser = argparse.ArgumentParser(
prog='graph-show',
description=__doc__,
)
parser.add_argument(
'-p', '--pulsar-host',
default=default_pulsar_host,
help=f'Pulsar host (default: {default_pulsar_host})',
)
args = parser.parse_args()
try:
show_graph(args.pulsar_host)
except Exception as e:
print("Exception:", e, flush=True)
main()