-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (52 loc) · 2.27 KB
/
main.py
File metadata and controls
65 lines (52 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from load_database import DatabaseHandler
import sys
def load_big_database(server_url, username, password, database_dir = './'):
'''Here we every time initilize a new object of DatabaseHandler so it take less memory each function'''
load_nodes(server_url, username, password, database_dir)
load_taxonomy_terms(server_url, username, password, database_dir)
load_field_collection_items(server_url, username, password, database_dir)
load_fields(server_url, username, password, database_dir)
print('Database is successfully loaded')
def load_nodes(server_url, username, password, database_dir):
a = DatabaseHandler(server_url, username, password, dir = database_dir)
a.csv_load_nodes()
def load_taxonomy_terms(server_url, username, password, database_dir):
a = DatabaseHandler(server_url, username, password, dir = database_dir)
a.csv_load_taxonomy_terms()
def load_field_collection_items(server_url, username, password, database_dir):
a = DatabaseHandler(server_url, username, password, dir = database_dir)
a.csv_load_field_collection_items()
def load_fields(server_url, username, password, database_dir):
a = DatabaseHandler(server_url, username, password, dir = database_dir)
a.csv_load_fields()
if(len(sys.argv) != 2):
database_dir = '../database/drupal'
# sys.exit('Invalid Argument: Requred 2 argument but ' + str(len(sys.argv)) + ' are provided')
else:
database_dir = sys.argv[1]
if(database_dir[-1] != '/'):
database_dir = database_dir + '/'
username = "neo4j"
password = "a392912030502"
server_url = 'bolt://localhost:7687'
a = DatabaseHandler(server_url, username, password, dir = database_dir)
# while(True):
# try:
# print('\n\n')
# print('1: Create New Database')
# print('2: Delete Whole Database')
# print('3: Count Nodes')
# choice = int(input('Enter choice : '))
# if(choice < 0):
# a.close()
# break
# elif(choice == 0):
# load_big_database(server_url, username, password, database_dir)
# elif(choice == 1):
# a.load_database()
# elif(choice == 2):
# a.delete_whole_database()
# else:
# print(a.count_nodes())
# except Exception as e:
# print('\n', e, '\n')