memgraph/tests/public_benchmark/ldbc/index_creation.py
Marko Budiselic a8e0792609 LDBC
Summary: Add LDBC helper scripts.

Reviewers: teon.banek, mferencevic, mislav.bradac

Reviewed By: teon.banek

Subscribers: pullbot, buda

Differential Revision: https://phabricator.memgraph.io/D563
2017-08-28 09:34:22 +02:00

27 lines
727 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from neo4j.v1 import GraphDatabase, basic_auth
# Initialize driver and create session.
driver = GraphDatabase.driver('bolt://localhost:7687',
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()