python-eigen-ingenuity-nocli 0.5.27__tar.gz → 0.5.28__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_eigen_ingenuity_nocli-0.5.27/python_eigen_ingenuity_nocli.egg-info → python_eigen_ingenuity_nocli-0.5.28}/PKG-INFO +1 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/assetmodelbuilder.py +5 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/configmanager.py +23 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/csvcontentsmanager.py +0 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/filemanager.py +24 -18
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/cypherfileprocessor.py +1 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/nodefileprocessor.py +22 -16
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/relationshipfileprocessor.py +33 -17
- python_eigen_ingenuity_nocli-0.5.28/modelbuilder/src/property.py +343 -0
- python_eigen_ingenuity_nocli-0.5.28/modelbuilder/src/querymanager.py +98 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28/python_eigen_ingenuity_nocli.egg-info}/PKG-INFO +1 -1
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/python_eigen_ingenuity_nocli.egg-info/SOURCES.txt +1 -0
- python_eigen_ingenuity_nocli-0.5.27/modelbuilder/src/property.py +0 -306
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/MANIFEST.in +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/README-nocli.md +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/README.md +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/assetmodel.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/auth.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/commonmenu.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/core/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/elastic.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/events.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/historian.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/historianmulti.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/logformatter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/settings.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/sql.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/eigeningenuity/util.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/config.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/demo.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_tagManagement.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/historianmulti/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/local-tests/run_tests.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/assetmodelcsvwriter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/assetmodelutilities.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/connectors/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/connectors/boltconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/connectors/dbconnectors.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/connectors/genericconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/connectors/httpsconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/csvwriter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/fileanalyser.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/messages.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/labelmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/propertymanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/processors/relationshipmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/queries/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/queries/cypherbuilder.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/queries/query.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/modelbuilder/src/versionmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/pyproject.toml +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/python_eigen_ingenuity_nocli.egg-info/dependency_links.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/python_eigen_ingenuity_nocli.egg-info/requires.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/python_eigen_ingenuity_nocli.egg-info/top_level.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_tagManagement.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/regressiontests/eigeningenuity/historian-multi/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/requirements.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/setup.cfg +0 -0
- {python_eigen_ingenuity_nocli-0.5.27 → python_eigen_ingenuity_nocli-0.5.28}/setup.py +0 -0
|
@@ -7,6 +7,7 @@ sys.path.append(current_dir)
|
|
|
7
7
|
from configmanager import ConfigManager
|
|
8
8
|
from connectors.dbconnectors import ConnectionManager
|
|
9
9
|
from filemanager import FileManager
|
|
10
|
+
from querymanager import QueryManager
|
|
10
11
|
|
|
11
12
|
import sys
|
|
12
13
|
import inspect
|
|
@@ -146,8 +147,11 @@ def _asset_model_builder_():
|
|
|
146
147
|
if config_manager.get_error_count() > 0:
|
|
147
148
|
sys.exit()
|
|
148
149
|
|
|
150
|
+
# Create a Query Manager
|
|
151
|
+
query_manager = QueryManager(config_manager.get_parameters())
|
|
152
|
+
|
|
149
153
|
# Create a csv file Manager to process all the input files
|
|
150
|
-
file_manager = FileManager(config_manager)
|
|
154
|
+
file_manager = FileManager(config_manager, query_manager)
|
|
151
155
|
file_manager.analyse_files()
|
|
152
156
|
|
|
153
157
|
# Create a connection to the database
|
|
@@ -211,7 +211,7 @@ class ConfigManager:
|
|
|
211
211
|
except:
|
|
212
212
|
database_num = None
|
|
213
213
|
|
|
214
|
-
if
|
|
214
|
+
if database_num is not None:
|
|
215
215
|
# Database number provided, so check if it's valid
|
|
216
216
|
if database_num < len(database_name_list):
|
|
217
217
|
database_index = database_num
|
|
@@ -312,6 +312,25 @@ class ConfigManager:
|
|
|
312
312
|
except:
|
|
313
313
|
self.alias_header_mappings_dict[s] = {}
|
|
314
314
|
|
|
315
|
+
# Read lists of parameters
|
|
316
|
+
params = {s: self.get_config_value_list(s, "Parameters", "") for s in self.available_sections}
|
|
317
|
+
self.parameters = {}
|
|
318
|
+
this_parm = ''
|
|
319
|
+
parm_list = []
|
|
320
|
+
for s in self.available_sections:
|
|
321
|
+
self.parameters[s] = {}
|
|
322
|
+
for parm in params[s]:
|
|
323
|
+
parm = parm.strip()
|
|
324
|
+
if parm[0] == '$':
|
|
325
|
+
if this_parm != '':
|
|
326
|
+
self.parameters[s][this_parm] = parm_list
|
|
327
|
+
this_parm = parm.split(':')[0][1:]
|
|
328
|
+
parm_list = [parm.split(':')[1]]
|
|
329
|
+
else:
|
|
330
|
+
parm_list.append(parm)
|
|
331
|
+
if this_parm != '':
|
|
332
|
+
self.parameters[s][this_parm] = parm_list
|
|
333
|
+
|
|
315
334
|
def get_error_list(self):
|
|
316
335
|
return self.error_list
|
|
317
336
|
|
|
@@ -593,3 +612,6 @@ class ConfigManager:
|
|
|
593
612
|
for error in self.error_list:
|
|
594
613
|
error_message(error)
|
|
595
614
|
return len(self.error_list)
|
|
615
|
+
|
|
616
|
+
def get_parameters(self):
|
|
617
|
+
return self.parameters
|
|
@@ -11,8 +11,9 @@ import os
|
|
|
11
11
|
|
|
12
12
|
class FileManager:
|
|
13
13
|
|
|
14
|
-
def __init__(self, config_manager):
|
|
14
|
+
def __init__(self, config_manager, query_manager):
|
|
15
15
|
self.config_manager = config_manager
|
|
16
|
+
self.query_manager = query_manager
|
|
16
17
|
self.validation_mode = config_manager.in_validation_mode()
|
|
17
18
|
self.report_queries = config_manager.get_show_query()
|
|
18
19
|
self.show_progress = config_manager.get_display_rate()
|
|
@@ -47,6 +48,8 @@ class FileManager:
|
|
|
47
48
|
self.file_analysers = {s: FileAnalyser(config_manager, s) for s in config_manager.get_available_sections()}
|
|
48
49
|
self.version_managers = {s: VersionManager(config_manager, s) for s in config_manager.get_available_sections()}
|
|
49
50
|
|
|
51
|
+
self.batch_debug = False
|
|
52
|
+
|
|
50
53
|
def check_section(self, in_file, empty_section_response):
|
|
51
54
|
file = in_file.split('#')[0].strip()
|
|
52
55
|
if file.startswith('#') or file == '':
|
|
@@ -225,19 +228,19 @@ class FileManager:
|
|
|
225
228
|
config_section = 'DEFAULT'
|
|
226
229
|
if config_section not in self.config_manager.get_available_sections():
|
|
227
230
|
# Use NodeFileProcessor as placeholder. It won't be used, other than to process the errors
|
|
228
|
-
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, None, 'DEFAULT')
|
|
231
|
+
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, None, 'DEFAULT', self.query_manager)
|
|
229
232
|
self.add_file_to_list(this_csv_file_processor, 'invalid config section', [])
|
|
230
233
|
else:
|
|
231
234
|
# Analyse each of the specified input .csv files to determine if they contain Nodes or Relationships
|
|
232
235
|
# If the file doesn't have a valid combination of columns (or is missing) they are placed in the appropriate list
|
|
233
236
|
this_csv_file_type, csv_contents, file_errors = self.file_analysers[config_section].determine_file_type(csv_file, 'csv')
|
|
234
237
|
if this_csv_file_type == 'nodes':
|
|
235
|
-
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, csv_contents, config_section)
|
|
238
|
+
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, csv_contents, config_section, self.query_manager)
|
|
236
239
|
elif this_csv_file_type == 'relationships':
|
|
237
|
-
this_csv_file_processor = RelationshipFileProcessor(csv_file, self.config_manager, csv_contents, config_section)
|
|
240
|
+
this_csv_file_processor = RelationshipFileProcessor(csv_file, self.config_manager, csv_contents, config_section, self.query_manager)
|
|
238
241
|
else:
|
|
239
242
|
# Use NodeFileProcessor as placeholder. It won't be used, other than to process the errors
|
|
240
|
-
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, csv_contents, config_section)
|
|
243
|
+
this_csv_file_processor = NodeFileProcessor(csv_file, self.config_manager, csv_contents, config_section, self.query_manager)
|
|
241
244
|
self.add_file_to_list(this_csv_file_processor, this_csv_file_type, file_errors)
|
|
242
245
|
|
|
243
246
|
def analyse_cypher_file(self, query_file):
|
|
@@ -390,8 +393,9 @@ class FileManager:
|
|
|
390
393
|
except:
|
|
391
394
|
display_rate = 0
|
|
392
395
|
|
|
393
|
-
|
|
394
|
-
|
|
396
|
+
if self.batch_debug:
|
|
397
|
+
total_new_nodes = 0
|
|
398
|
+
total_new_relationships = 0
|
|
395
399
|
|
|
396
400
|
if display_rate > 0:
|
|
397
401
|
message(f'0 of {num_queries} queries processed at {amu.get_formatted_time_now()}', False)
|
|
@@ -413,14 +417,15 @@ class FileManager:
|
|
|
413
417
|
if result.get_status() == 200:
|
|
414
418
|
|
|
415
419
|
# Display info on how many of each batch were created
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
420
|
+
if self.batch_debug:
|
|
421
|
+
new_nodes = result.get_updates()['nodes created']
|
|
422
|
+
total_new_nodes += new_nodes
|
|
423
|
+
new_relationships = result.get_updates()['relationships created']
|
|
424
|
+
total_new_relationships += new_relationships
|
|
425
|
+
if new_nodes > 0 or new_relationships > 0:
|
|
426
|
+
if (query.type == 'batch node' and new_nodes != query.batch_size) or (query.type == 'batch relationship' and new_relationships != query.batch_size):
|
|
427
|
+
info_message(f'Batch {query_count} contained {query.batch_size} updates: only {new_nodes+new_relationships} created')
|
|
428
|
+
print(query.text)
|
|
424
429
|
|
|
425
430
|
if self.report_queries:
|
|
426
431
|
result.print_results('Updates made: ')
|
|
@@ -456,9 +461,10 @@ class FileManager:
|
|
|
456
461
|
if display_rate > 0 and not self.report_queries:
|
|
457
462
|
if query_count % display_rate == 0 or query_count == num_queries:
|
|
458
463
|
message(f'{query_count} of {num_queries} queries processed at {amu.get_formatted_time_now()} ({query_count / num_queries * 100:.2f}%)', False)
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
464
|
+
if self.batch_debug:
|
|
465
|
+
message(f'{query_count} of {num_queries} queries processed at {amu.get_formatted_time_now()} ({query_count / num_queries * 100:.2f}%) Nodes: {total_new_nodes}, Relationships: {total_new_relationships}', False)
|
|
466
|
+
total_new_nodes = 0
|
|
467
|
+
total_new_relationships = 0
|
|
462
468
|
else:
|
|
463
469
|
message_no_cr(f'{query_count} of {num_queries} queries processed ({batch_info}{query_count / num_queries * 100:.2f}%) {chr(13)}')
|
|
464
470
|
|
|
@@ -26,7 +26,7 @@ class CypherFileProcessor:
|
|
|
26
26
|
entry_count = 0
|
|
27
27
|
while entry_count < cypher_file_size:
|
|
28
28
|
this_entry = cypher_list[entry_count].strip()
|
|
29
|
-
if not this_entry.startswith('#') and not this_entry == '\n':
|
|
29
|
+
if not this_entry.startswith('#') and not this_entry == '\n' and not this_entry == '':
|
|
30
30
|
next_query += this_entry + '\n'
|
|
31
31
|
if not this_entry.endswith(',') and not this_entry.endswith('\\'):
|
|
32
32
|
while next_query.endswith('\n'):
|
|
@@ -11,9 +11,11 @@ from property import Neo4jProperty
|
|
|
11
11
|
|
|
12
12
|
class NodeFileProcessor:
|
|
13
13
|
|
|
14
|
-
def __init__(self, filename, config, contents, section):
|
|
14
|
+
def __init__(self, filename, config, contents, section, query_manager):
|
|
15
15
|
self.filename = filename
|
|
16
16
|
self.contents = contents
|
|
17
|
+
self.section = section
|
|
18
|
+
self.query_manager = query_manager
|
|
17
19
|
|
|
18
20
|
self.primary_property = config.get_primary_property()[section]
|
|
19
21
|
self.add_system_properties = not config.get_no_system_properties()
|
|
@@ -41,8 +43,6 @@ class NodeFileProcessor:
|
|
|
41
43
|
self.label_types = amu.label_types
|
|
42
44
|
self.all_types = amu.all_types
|
|
43
45
|
|
|
44
|
-
self.section = section
|
|
45
|
-
|
|
46
46
|
def get_last_row(self, num_rows):
|
|
47
47
|
if self.last_row < 0:
|
|
48
48
|
last_row = num_rows
|
|
@@ -108,13 +108,12 @@ class NodeFileProcessor:
|
|
|
108
108
|
query_text = query_text.set(properties=calculated_properties, property_ref=property_ref_dot)
|
|
109
109
|
|
|
110
110
|
query_text = query_text.toStr()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
queries.append(query)
|
|
111
|
+
query_list = self.query_manager.parameterise(query_text, self.section)
|
|
112
|
+
for a_query in query_list:
|
|
113
|
+
query = Neo4jQuery('node', a_query, time_now, merge_labels, new_labels, primary_property, properties, self.section)
|
|
114
|
+
if self.validate_only and not self.summarise:
|
|
115
|
+
print(a_query)
|
|
116
|
+
queries.append(query)
|
|
118
117
|
|
|
119
118
|
this_row += 1
|
|
120
119
|
messages.message_no_cr(f'Generating queries... {100 * (this_row - self.start_from + 1) / num_rows:.0f}%{chr(13)}')
|
|
@@ -170,8 +169,14 @@ class NodeFileProcessor:
|
|
|
170
169
|
all_properties = pm.combine_properties(properties, primary_property_dict)
|
|
171
170
|
|
|
172
171
|
explicit_properties, calculated_properties = pm.split_out_functional_properties(all_properties)
|
|
172
|
+
param_explicit_props = self.query_manager.parameterise_dict(explicit_properties, self.section)
|
|
173
|
+
param_calc_props = self.query_manager.parameterise_dict(calculated_properties, self.section)
|
|
174
|
+
|
|
175
|
+
query_data_list = []
|
|
176
|
+
for count in range(max(len(param_explicit_props), len(param_calc_props))):
|
|
177
|
+
query_data_list += [[param_explicit_props[min(count, len(param_explicit_props)-1)], param_calc_props[min(count, len(param_calc_props)-1)], time_now]]
|
|
173
178
|
|
|
174
|
-
|
|
179
|
+
# prop_data = [explicit_properties, calculated_properties, time_now]
|
|
175
180
|
|
|
176
181
|
# So now we know all about this particular update. Let's put it in the query dictionary
|
|
177
182
|
# We'll group these by unique combinations of labels and primary key type
|
|
@@ -179,12 +184,12 @@ class NodeFileProcessor:
|
|
|
179
184
|
dictionary_key = [new_labels, merge_labels, remove_labels, [primary_property.key], calculated_properties.keys()]
|
|
180
185
|
try:
|
|
181
186
|
dictionary_index = batch_keys.index(dictionary_key)
|
|
182
|
-
query_dictionary[dictionary_index]
|
|
187
|
+
query_dictionary[dictionary_index] += query_data_list
|
|
183
188
|
except:
|
|
184
189
|
dictionary_index = len(batch_keys)
|
|
185
|
-
query_dictionary[dictionary_index] =
|
|
190
|
+
query_dictionary[dictionary_index] = query_data_list
|
|
186
191
|
batch_keys.append(dictionary_key)
|
|
187
|
-
dict_size +=
|
|
192
|
+
dict_size += len(query_data_list)
|
|
188
193
|
|
|
189
194
|
this_row += 1
|
|
190
195
|
messages.message_no_cr(f'Analysing file... {100 * (this_row - self.start_from + 1) / num_rows:.0f}%{chr(13)}')
|
|
@@ -221,8 +226,9 @@ class NodeFileProcessor:
|
|
|
221
226
|
formatted_payload = []
|
|
222
227
|
property_count = 0
|
|
223
228
|
for a_payload in payload:
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
formatted_pload = property.format(a_payload, property_ref_dot, self.query_manager, self.section)
|
|
230
|
+
formatted_payload += formatted_pload
|
|
231
|
+
property_count += len(a_payload)*len(formatted_pload)
|
|
226
232
|
|
|
227
233
|
# Build a MERGE query using queries
|
|
228
234
|
merge_labels = batch_keys[new_labels][1]
|
|
@@ -11,10 +11,11 @@ from property import Neo4jProperty
|
|
|
11
11
|
|
|
12
12
|
class RelationshipFileProcessor:
|
|
13
13
|
|
|
14
|
-
def __init__(self, filename, config, contents, section):
|
|
14
|
+
def __init__(self, filename, config, contents, section, query_manager):
|
|
15
15
|
self.filename = filename
|
|
16
16
|
self.contents = contents
|
|
17
17
|
self.section = section
|
|
18
|
+
self.query_manager = query_manager
|
|
18
19
|
|
|
19
20
|
self.primary_property = config.get_primary_property()[section]
|
|
20
21
|
self.add_system_properties = not config.get_no_system_properties()
|
|
@@ -130,12 +131,13 @@ class RelationshipFileProcessor:
|
|
|
130
131
|
query_text = query_text.set(properties=calculated_properties, property_ref=relation_ref_dot)
|
|
131
132
|
|
|
132
133
|
query_text = query_text.toStr()
|
|
133
|
-
|
|
134
|
+
query_list = self.query_manager.parameterise(query_text, self.section)
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
for a_query in query_list:
|
|
137
|
+
query = Neo4jQuery('node', a_query, time_now)
|
|
138
|
+
if self.validate_only and not self.summarise:
|
|
139
|
+
print(a_query)
|
|
140
|
+
queries.append(query)
|
|
139
141
|
|
|
140
142
|
this_row += 1
|
|
141
143
|
messages.message_no_cr(f'Generating queries... {100 * (this_row - self.start_from + 1) / num_rows:.0f}%{chr(13)}')
|
|
@@ -172,6 +174,7 @@ class RelationshipFileProcessor:
|
|
|
172
174
|
# Since the dictionary key can't be a list, we will create a list (of lists) and use the index in that list as the key
|
|
173
175
|
# When we have worked through all the input and grouped the queries by label and relationship combinations, we will create the queries
|
|
174
176
|
|
|
177
|
+
new_labels_list = []
|
|
175
178
|
batch_keys = []
|
|
176
179
|
query_dictionary = {}
|
|
177
180
|
dict_size = 0
|
|
@@ -203,18 +206,29 @@ class RelationshipFileProcessor:
|
|
|
203
206
|
if relation:
|
|
204
207
|
|
|
205
208
|
explicit_properties, calculated_properties = pm.split_out_functional_properties(properties)
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
|
|
210
|
+
param_from_nodes = self.query_manager.parameterise_list([from_node], self.section)
|
|
211
|
+
param_to_nodes = self.query_manager.parameterise_list([to_node], self.section)
|
|
212
|
+
param_explicit_props = self.query_manager.parameterise_dict(explicit_properties, self.section)
|
|
213
|
+
param_calc_props = self.query_manager.parameterise_dict(calculated_properties, self.section)
|
|
214
|
+
|
|
215
|
+
query_data_list = []
|
|
216
|
+
for count in range(max(len(param_from_nodes), len(param_to_nodes), len(param_explicit_props), len(param_calc_props))):
|
|
217
|
+
new_labels_list = [[from_labels, to_labels, relation, from_node.key, to_node.key, param_calc_props[min(count, len(param_calc_props) - 1)]]]
|
|
218
|
+
query_data_list += [[param_from_nodes[min(count, len(param_from_nodes) - 1)].value.replace('\\\\n', '\n'), param_to_nodes[min(count, len(param_to_nodes) - 1)].value.replace('\\\\n', '\n'), param_explicit_props[min(count, len(param_explicit_props) - 1)], param_calc_props[min(count, len(param_calc_props) - 1)], time_now]]
|
|
208
219
|
|
|
209
220
|
# So now we know all about this particular update. Let's put it in the query dictionary
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
q_count = 0
|
|
222
|
+
for count in range(len(new_labels_list)):
|
|
223
|
+
q_count += 1
|
|
224
|
+
try:
|
|
225
|
+
dictionary_index = batch_keys.index(new_labels_list[count])
|
|
226
|
+
query_dictionary[dictionary_index] += query_data_list
|
|
227
|
+
except:
|
|
228
|
+
dictionary_index = len(batch_keys)
|
|
229
|
+
query_dictionary[dictionary_index] = query_data_list
|
|
230
|
+
batch_keys.append(new_labels_list[count])
|
|
231
|
+
dict_size += len(query_data_list)
|
|
218
232
|
|
|
219
233
|
this_row += 1
|
|
220
234
|
messages.message_no_cr(f'Analysing file... {100 * (this_row - self.start_from + 1) / num_rows:.0f}%{chr(13)}')
|
|
@@ -256,7 +270,9 @@ class RelationshipFileProcessor:
|
|
|
256
270
|
|
|
257
271
|
formatted_payload = []
|
|
258
272
|
for a_payload in payload:
|
|
259
|
-
|
|
273
|
+
formatted_pload = property.format(a_payload, '', self.query_manager, self.section)
|
|
274
|
+
formatted_payload += formatted_pload
|
|
275
|
+
|
|
260
276
|
# Build a MERGE query using queries
|
|
261
277
|
from_keys = " {" + from_node + ":" + payload_ref_dot + from_ref + "}"
|
|
262
278
|
to_keys = " {" + to_node + ":" + payload_ref_dot + to_ref + "}"
|