memgraph/tests/public_benchmark/ldbc/index_creation.py

28 lines
784 B
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from neo4j.v1 import GraphDatabase, basic_auth
# Initialize driver and create session.
port = sys.argv[2] if len(sys.argv) > 2 else '7687'
driver = GraphDatabase.driver('bolt://localhost:%s' % port,
auth=basic_auth('', ''),
encrypted=False)
session = driver.session()
# The fist program argument is path to a file with indexes.
try:
with open(sys.argv[1], "r") as f:
for line in f.readlines():
session.run(line.strip()).consume()
print("%s -> DONE" % line.strip())
print("All indexes were created.")
except:
print("Frist argument is path to a file with indexes.")
# Do the cleanup.
session.close()
driver.close()