python-eigen-ingenuity 0.5.31b1__tar.gz → 0.5.32__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-0.5.31b1/python_eigen_ingenuity.egg-info → python_eigen_ingenuity-0.5.32}/PKG-INFO +1 -1
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/historianmulti.py +70 -54
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/configmanager.py +2 -1
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/filemanager.py +29 -12
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/labelmanager.py +1 -1
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/nodefileprocessor.py +31 -21
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/relationshipfileprocessor.py +46 -39
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/property.py +96 -83
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/querymanager.py +1 -1
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32/python_eigen_ingenuity.egg-info}/PKG-INFO +1 -1
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/MANIFEST.in +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/README-nocli.md +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/README.md +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/assetmodel.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/auth.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/commonmenu.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/core/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/elastic.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/events.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/historian.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/logformatter.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/settings.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/sql.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/util.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/common.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/config.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/demo.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/common_multi.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getMetaData.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_listDataTags.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_tagManagement.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/historianmulti/test_writePoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/local-tests/run_tests.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/assetmodelbuilder.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/assetmodelcsvwriter.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/assetmodelutilities.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/connectors/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/connectors/boltconnector.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/connectors/dbconnectors.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/connectors/genericconnector.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/connectors/httpsconnector.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/csvcontentsmanager.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/csvwriter.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/fileanalyser.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/messages.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/cypherfileprocessor.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/propertymanager.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/processors/relationshipmanager.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/queries/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/queries/cypherbuilder.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/queries/query.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/versionmanager.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/pyproject.toml +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/python_eigen_ingenuity.egg-info/SOURCES.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/python_eigen_ingenuity.egg-info/dependency_links.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/python_eigen_ingenuity.egg-info/entry_points.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/python_eigen_ingenuity.egg-info/requires.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/python_eigen_ingenuity.egg-info/top_level.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/common.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/common_multi.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/common.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/__init__.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/common_multi.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getMetaData.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_listDataTags.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_tagManagement.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/regressiontests/eigeningenuity/historian-multi/test_writePoints.py +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/requirements.txt +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/setup.cfg +0 -0
- {python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/setup.py +0 -0
{python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/eigeningenuity/historianmulti.py
RENAMED
|
@@ -3,36 +3,37 @@
|
|
|
3
3
|
This package deals with the Eigen Ingenuity Historian API, mostly by means
|
|
4
4
|
of the JSON Bridge Historian.
|
|
5
5
|
|
|
6
|
-
To get a
|
|
6
|
+
To get a historianmulti object to work with, use get_historian_multi(xxx) with either
|
|
7
7
|
an instance name (which will be resolved via the the usual methods in
|
|
8
8
|
eigeningenuity.core) or a full URL to a JSON Bridge Historian instance.
|
|
9
9
|
|
|
10
|
-
from eigeningenuity.
|
|
10
|
+
from eigeningenuity.historianmulti import get_historian_multi
|
|
11
11
|
from time import gmtime, asctime
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
tags =
|
|
13
|
+
hm = get_historian_multi("pi-opc")
|
|
14
|
+
tags = hm.listDataTags()
|
|
15
15
|
for tag in tags:
|
|
16
|
-
dp =
|
|
16
|
+
dp = hm.getCurrentDataPoints(tag)
|
|
17
17
|
print(asctime(time.gmtime(dp['timestamp'])), dp['value'])
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
import requests
|
|
21
20
|
import re
|
|
22
|
-
from typing import Union
|
|
23
21
|
from datetime import datetime
|
|
22
|
+
from typing import Union
|
|
23
|
+
from urllib.error import URLError
|
|
24
24
|
|
|
25
|
+
import requests
|
|
25
26
|
from requests.exceptions import ConnectionError
|
|
26
|
-
|
|
27
|
-
from eigeningenuity.core import
|
|
27
|
+
|
|
28
|
+
from eigeningenuity.core import EigenServer, get_default_server
|
|
28
29
|
from eigeningenuity.util import (
|
|
29
|
-
force_list,
|
|
30
|
-
time_to_epoch_millis,
|
|
31
30
|
EigenException,
|
|
32
|
-
merge_tags_from_response,
|
|
33
|
-
update_keys,
|
|
34
31
|
_do_historian_multi_request,
|
|
32
|
+
force_list,
|
|
35
33
|
format_output,
|
|
34
|
+
merge_tags_from_response,
|
|
35
|
+
time_to_epoch_millis,
|
|
36
|
+
update_keys,
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
|
|
@@ -88,7 +89,7 @@ class HistorianMulti(object):
|
|
|
88
89
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
89
90
|
RuntimeError: If no response is received from the API.
|
|
90
91
|
HTTPError: If the API request fails.
|
|
91
|
-
|
|
92
|
+
|
|
92
93
|
Docs:
|
|
93
94
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getcurrentdatapoints
|
|
94
95
|
"""
|
|
@@ -132,7 +133,7 @@ class HistorianMulti(object):
|
|
|
132
133
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
133
134
|
RuntimeError: If no response is received from the API.
|
|
134
135
|
HTTPError: If the API request fails.
|
|
135
|
-
|
|
136
|
+
|
|
136
137
|
Docs:
|
|
137
138
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getinterpolatedpoints
|
|
138
139
|
"""
|
|
@@ -188,7 +189,7 @@ class HistorianMulti(object):
|
|
|
188
189
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
189
190
|
RuntimeError: If no response is received from the API.
|
|
190
191
|
HTTPError: If the API request fails.
|
|
191
|
-
|
|
192
|
+
|
|
192
193
|
Docs:
|
|
193
194
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getinterpolatedrange
|
|
194
195
|
"""
|
|
@@ -245,7 +246,7 @@ class HistorianMulti(object):
|
|
|
245
246
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
246
247
|
RuntimeError: If no response is received from the API.
|
|
247
248
|
HTTPError: If the API request fails.
|
|
248
|
-
|
|
249
|
+
|
|
249
250
|
Docs:
|
|
250
251
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getrawdatapoints
|
|
251
252
|
"""
|
|
@@ -285,24 +286,24 @@ class HistorianMulti(object):
|
|
|
285
286
|
):
|
|
286
287
|
"""Get the closest raw point to one or more timestamps.
|
|
287
288
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
289
|
+
Args:
|
|
290
|
+
tags (Union[str, list]): Tag name or list of tags to query.
|
|
291
|
+
timestamps (Union[int, float, str, datetime, list]): One or more timestamps to find closest raw points for.
|
|
292
|
+
before_or_after (str, optional): Selection rule for closest point. Defaults to "AFTER_OR_AT".
|
|
293
|
+
output (str, optional): Output format selector. Accepts "json", "df", "raw", "string". Defaults to "json".
|
|
294
|
+
|
|
295
|
+
Returns:
|
|
296
|
+
dict|list|pandas.DataFrame|str: Closest raw points to the timestamps. Format depends on output parameter.
|
|
297
|
+
|
|
298
|
+
Raises:
|
|
299
|
+
ValueError: When invalid Output Type is given
|
|
300
|
+
URLError: If no Ingenuity instance can be reached or no internet connection is available.
|
|
301
|
+
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
302
|
+
RuntimeError: If no response is received from the API.
|
|
303
|
+
HTTPError: If the API request fails.
|
|
304
|
+
|
|
305
|
+
Docs:
|
|
306
|
+
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getclosestrawpoint
|
|
306
307
|
"""
|
|
307
308
|
before_or_after = before_or_after.upper()
|
|
308
309
|
|
|
@@ -374,7 +375,7 @@ class HistorianMulti(object):
|
|
|
374
375
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
375
376
|
RuntimeError: If no response is received from the API.
|
|
376
377
|
HTTPError: If the API request fails.
|
|
377
|
-
|
|
378
|
+
|
|
378
379
|
Docs:
|
|
379
380
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getaggregates
|
|
380
381
|
"""
|
|
@@ -465,7 +466,7 @@ class HistorianMulti(object):
|
|
|
465
466
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
466
467
|
RuntimeError: If no response is received from the API.
|
|
467
468
|
HTTPError: If the API request fails.
|
|
468
|
-
|
|
469
|
+
|
|
469
470
|
Docs:
|
|
470
471
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/reading-data/getaggregateintervals
|
|
471
472
|
"""
|
|
@@ -549,7 +550,7 @@ class HistorianMulti(object):
|
|
|
549
550
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
550
551
|
RuntimeError: If no response is received from the API.
|
|
551
552
|
HTTPError: If the API request fails.
|
|
552
|
-
|
|
553
|
+
|
|
553
554
|
Docs:
|
|
554
555
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/metadata/listdatatags
|
|
555
556
|
"""
|
|
@@ -559,14 +560,20 @@ class HistorianMulti(object):
|
|
|
559
560
|
|
|
560
561
|
return tags
|
|
561
562
|
|
|
562
|
-
def getMetaData(
|
|
563
|
+
def getMetaData(
|
|
564
|
+
self,
|
|
565
|
+
historian: str = None,
|
|
566
|
+
limit: int = 100,
|
|
567
|
+
match: str = "",
|
|
568
|
+
output: str = "json",
|
|
569
|
+
):
|
|
563
570
|
"""Fetch tag metadata for a historian, optionally filtered with a wildcard.
|
|
564
571
|
|
|
565
572
|
Args:
|
|
566
573
|
historian (str, optional): Historian name to search.
|
|
567
574
|
limit (int, optional): Max number of tags returned. Defaults to 100.
|
|
568
575
|
match (str, optional): Wildcard pattern for tag names. Defaults to "".
|
|
569
|
-
|
|
576
|
+
output (str, optional): Output format selector. Accepts "json", "raw". Defaults to "json".
|
|
570
577
|
Returns:
|
|
571
578
|
list[dict]: List of metadata dictionaries for each tag.
|
|
572
579
|
|
|
@@ -575,12 +582,16 @@ class HistorianMulti(object):
|
|
|
575
582
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
576
583
|
RuntimeError: If no response is received from the API.
|
|
577
584
|
HTTPError: If the API request fails.
|
|
578
|
-
|
|
585
|
+
|
|
579
586
|
Docs:
|
|
580
587
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/metadata/getmetadata
|
|
581
588
|
"""
|
|
582
|
-
if historian
|
|
583
|
-
|
|
589
|
+
if "/" in historian and match == "":
|
|
590
|
+
split_hist = historian.split("/")
|
|
591
|
+
match = split_hist[1]
|
|
592
|
+
historian = split_hist[0]
|
|
593
|
+
elif historian is None:
|
|
594
|
+
historian = self.historian[0:-1]
|
|
584
595
|
|
|
585
596
|
resp = _do_historian_multi_request(
|
|
586
597
|
self.searchurl + f"?historian={historian}&limit={limit}&search={match}",
|
|
@@ -590,7 +601,12 @@ class HistorianMulti(object):
|
|
|
590
601
|
)
|
|
591
602
|
metadata = resp["tags"]
|
|
592
603
|
|
|
593
|
-
|
|
604
|
+
if output == "raw":
|
|
605
|
+
return metadata
|
|
606
|
+
elif output == "json":
|
|
607
|
+
return {tag["tagName"]: tag for tag in metadata}
|
|
608
|
+
else:
|
|
609
|
+
raise ValueError(f"Invalid output format: {output}")
|
|
594
610
|
|
|
595
611
|
def listHistorians(self, writable):
|
|
596
612
|
"""Retrieve all historians available on the Ingenuity instance.
|
|
@@ -608,7 +624,7 @@ class HistorianMulti(object):
|
|
|
608
624
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
609
625
|
RuntimeError: If no response is received from the API.
|
|
610
626
|
HTTPError: If the API request fails.
|
|
611
|
-
|
|
627
|
+
|
|
612
628
|
Docs:
|
|
613
629
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/metadata/listhistorians
|
|
614
630
|
"""
|
|
@@ -619,9 +635,9 @@ class HistorianMulti(object):
|
|
|
619
635
|
self.auth,
|
|
620
636
|
get_request=True,
|
|
621
637
|
)
|
|
622
|
-
|
|
638
|
+
|
|
623
639
|
historians = resp["historians"]
|
|
624
|
-
|
|
640
|
+
|
|
625
641
|
metadata = [x["name"] for x in historians]
|
|
626
642
|
|
|
627
643
|
return metadata
|
|
@@ -651,7 +667,7 @@ class HistorianMulti(object):
|
|
|
651
667
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
652
668
|
RuntimeError: If no response is received from the API.
|
|
653
669
|
HTTPError: If the API request fails.
|
|
654
|
-
|
|
670
|
+
|
|
655
671
|
Docs:
|
|
656
672
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/metadata/createtag
|
|
657
673
|
"""
|
|
@@ -706,7 +722,7 @@ class HistorianMulti(object):
|
|
|
706
722
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
707
723
|
RuntimeError: If no response is received from the API.
|
|
708
724
|
HTTPError: If the API request fails.
|
|
709
|
-
|
|
725
|
+
|
|
710
726
|
Docs:
|
|
711
727
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/metadata/updatetag
|
|
712
728
|
"""
|
|
@@ -763,7 +779,7 @@ class HistorianMulti(object):
|
|
|
763
779
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
764
780
|
RuntimeError: If no response is received from the API.
|
|
765
781
|
HTTPError: If the API request fails.
|
|
766
|
-
|
|
782
|
+
|
|
767
783
|
Docs:
|
|
768
784
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/writing-data/createandpopulatetag
|
|
769
785
|
"""
|
|
@@ -823,7 +839,7 @@ class HistorianMulti(object):
|
|
|
823
839
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
824
840
|
RuntimeError: If no response is received from the API.
|
|
825
841
|
HTTPError: If the API request fails.
|
|
826
|
-
|
|
842
|
+
|
|
827
843
|
Docs:
|
|
828
844
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/writing-data/writepoints
|
|
829
845
|
"""
|
|
@@ -861,7 +877,7 @@ class HistorianMulti(object):
|
|
|
861
877
|
RemoteServerException: If the historian cannot be found or the API returns an error.
|
|
862
878
|
RuntimeError: If no response is received from the API.
|
|
863
879
|
HTTPError: If the API request fails.
|
|
864
|
-
|
|
880
|
+
|
|
865
881
|
Docs:
|
|
866
882
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/writing-data/writepointsbatch
|
|
867
883
|
"""
|
|
@@ -916,7 +932,7 @@ def createPoint(
|
|
|
916
932
|
|
|
917
933
|
Raises:
|
|
918
934
|
EigenException: If status is not "OK" or "BAD".
|
|
919
|
-
|
|
935
|
+
|
|
920
936
|
Docs:
|
|
921
937
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/writing-data/createpoint
|
|
922
938
|
"""
|
|
@@ -937,7 +953,7 @@ def get_historian_multi(
|
|
|
937
953
|
|
|
938
954
|
Returns:
|
|
939
955
|
HistorianMulti: An object that can be used to query historian data.
|
|
940
|
-
|
|
956
|
+
|
|
941
957
|
Docs:
|
|
942
958
|
https://docs.eigeningenuity.co/developing-with-eigen/python-library/historian-multi/get_historian_multi
|
|
943
959
|
"""
|
{python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/configmanager.py
RENAMED
|
@@ -265,6 +265,7 @@ class ConfigManager:
|
|
|
265
265
|
self.no_version = True
|
|
266
266
|
|
|
267
267
|
def read_csv_config(self):
|
|
268
|
+
self.default_encoding = self.get_config_value("DEFAULT", "Encoding", False)
|
|
268
269
|
self.separators = {s: self.get_config_value(s, "Separator", self.separator, allow_comma=True) for s in self.available_sections}
|
|
269
270
|
self.primary_property = {s: self.primary_property_override or self.get_config_value(s, "PrimaryProperty", "node") for s in self.available_sections}
|
|
270
271
|
self.default_data_type = {s: self.get_config_value(s, "DataType", "") for s in self.available_sections}
|
|
@@ -638,7 +639,7 @@ class ConfigManager:
|
|
|
638
639
|
return self.logger
|
|
639
640
|
|
|
640
641
|
def get_force_encoding(self):
|
|
641
|
-
return self.force_encoding
|
|
642
|
+
return self.force_encoding or self.default_encoding
|
|
642
643
|
|
|
643
644
|
def get_detect_encoding(self):
|
|
644
645
|
return self.detect_encoding
|
{python_eigen_ingenuity-0.5.31b1 → python_eigen_ingenuity-0.5.32}/modelbuilder/src/filemanager.py
RENAMED
|
@@ -40,6 +40,7 @@ class FileManager:
|
|
|
40
40
|
# And a list of lists for the queries in specified priority order
|
|
41
41
|
self.valid_file_list = [[], [], [], [], [], []]
|
|
42
42
|
|
|
43
|
+
self.file_count = 0
|
|
43
44
|
self.invalid_file_count = 0
|
|
44
45
|
|
|
45
46
|
self.config_section = config_manager.get_config_section()
|
|
@@ -87,8 +88,10 @@ class FileManager:
|
|
|
87
88
|
file = a_file
|
|
88
89
|
this_section = section
|
|
89
90
|
self.analyse_csv_file(file, this_section)
|
|
91
|
+
self.file_count += 1
|
|
90
92
|
case 'cypher' | 'qry':
|
|
91
93
|
self.analyse_cypher_file(a_file)
|
|
94
|
+
self.file_count += 1
|
|
92
95
|
case 'lst':
|
|
93
96
|
self.analyse_lst_file(a_file, section)
|
|
94
97
|
case _:
|
|
@@ -106,6 +109,7 @@ class FileManager:
|
|
|
106
109
|
self.valid_file_list[priority] += [{'processor': file_processor, 'type': file_type}]
|
|
107
110
|
else:
|
|
108
111
|
info_message(file_processor.get_filename(), ' not processed as requested')
|
|
112
|
+
self.file_count -= 1
|
|
109
113
|
|
|
110
114
|
def analyse_lst_file(self, filename, def_section=''):
|
|
111
115
|
recurse_dirs = self.config_manager.get_recurse_dirs()
|
|
@@ -162,12 +166,14 @@ class FileManager:
|
|
|
162
166
|
else:
|
|
163
167
|
query_processor = CypherFileProcessor(a_query, self.config_manager, True)
|
|
164
168
|
self.add_file_to_process_list(query_processor, 'pre')
|
|
169
|
+
self.file_count += 1
|
|
165
170
|
|
|
166
171
|
labels_to_delete_list = self.config_manager.get_labels_to_delete_list()
|
|
167
172
|
if labels_to_delete_list == []:
|
|
168
173
|
query = 'MATCH (n) DETACH DELETE n'
|
|
169
174
|
query_processor = CypherFileProcessor(query, self.config_manager, True)
|
|
170
175
|
self.add_file_to_process_list(query_processor, 'pre')
|
|
176
|
+
self.file_count += 1
|
|
171
177
|
else:
|
|
172
178
|
for label_list in labels_to_delete_list:
|
|
173
179
|
match_list = ''
|
|
@@ -183,6 +189,7 @@ class FileManager:
|
|
|
183
189
|
query += 'DETACH DELETE n'
|
|
184
190
|
query_processor = CypherFileProcessor(query, self.config_manager, True)
|
|
185
191
|
self.add_file_to_process_list(query_processor, 'pre')
|
|
192
|
+
self.file_count += 1
|
|
186
193
|
|
|
187
194
|
# Process each file in the list, and determine its content type (ignoring any clues in the filename!)
|
|
188
195
|
# Analyse each of the specified input .csv files to determine if they contain Nodes or Relationships
|
|
@@ -190,13 +197,13 @@ class FileManager:
|
|
|
190
197
|
file_list = self.config_manager.get_input_file_list()
|
|
191
198
|
dir_list = self.config_manager.get_input_dir_list()
|
|
192
199
|
recurse_dirs = self.config_manager.get_recurse_dirs()
|
|
193
|
-
|
|
200
|
+
|
|
194
201
|
for a_file in file_list:
|
|
195
202
|
a_file_split = a_file.split(',')
|
|
196
203
|
for a_split_file in a_file_split:
|
|
197
204
|
if a_split_file != '':
|
|
198
205
|
self.analyse_a_file(a_split_file.strip(), self.config_section)
|
|
199
|
-
|
|
206
|
+
|
|
200
207
|
for a_dir in dir_list:
|
|
201
208
|
a_dir_split = a_dir.split(',')
|
|
202
209
|
for a_split_dir in a_dir_split:
|
|
@@ -238,6 +245,7 @@ class FileManager:
|
|
|
238
245
|
else:
|
|
239
246
|
query_processor = CypherFileProcessor(a_query, self.config_manager, True)
|
|
240
247
|
self.add_file_to_process_list(query_processor, 'post')
|
|
248
|
+
self.file_count += 1
|
|
241
249
|
|
|
242
250
|
def add_file_to_list(self, this_file_processor, this_file_type, file_errors=None):
|
|
243
251
|
|
|
@@ -317,6 +325,7 @@ class FileManager:
|
|
|
317
325
|
def process_not_found_files(self):
|
|
318
326
|
for file in self.file_not_found_list:
|
|
319
327
|
warning_message(f'{file} not found')
|
|
328
|
+
self.file_count -= 1
|
|
320
329
|
|
|
321
330
|
def process_unrecognised_file_type_files(self):
|
|
322
331
|
for file in self.unrecognised_file_type_list:
|
|
@@ -325,43 +334,50 @@ class FileManager:
|
|
|
325
334
|
def process_incorrect_files(self):
|
|
326
335
|
for file in self.incorrect_file_list:
|
|
327
336
|
error_message(f'{file} is not a correctly formatted .csv file - file not processed')
|
|
337
|
+
self.file_count -= 1
|
|
328
338
|
|
|
329
339
|
def process_incorrect_sections(self):
|
|
330
340
|
for file in self.incorrect_section_list:
|
|
331
341
|
error_message(f'{file} has an invalid config section - file not processed')
|
|
342
|
+
self.file_count -= 1
|
|
332
343
|
|
|
333
344
|
def process_incomplete_files(self):
|
|
334
345
|
for file in self.incomplete_file_list:
|
|
335
346
|
error_message(f'{file[0]} has incomplete data in rows {file[1]} - file not processed')
|
|
347
|
+
self.file_count -= 1
|
|
336
348
|
|
|
337
349
|
def process_neither_found_files(self):
|
|
338
350
|
for file in self.neither_file_list:
|
|
339
351
|
error_message(f'Insufficient data in {file} to determine content type - file not processed')
|
|
352
|
+
self.file_count -= 1
|
|
340
353
|
|
|
341
354
|
def process_both_files(self):
|
|
342
355
|
for file in self.both_file_list:
|
|
343
356
|
error_message(f'Ambiguous data in {file} - could be multiple content types - file not processed')
|
|
357
|
+
self.file_count -= 1
|
|
344
358
|
|
|
345
359
|
def process_valid_files(self, db_connector):
|
|
360
|
+
file_count = 0
|
|
346
361
|
num_queries = 0
|
|
347
362
|
for group in self.valid_file_list:
|
|
348
363
|
for file in group:
|
|
364
|
+
file_count += 1
|
|
349
365
|
processor = file['processor']
|
|
350
366
|
match file['type']:
|
|
351
367
|
case 'n':
|
|
352
368
|
if self.batch_rate == 0:
|
|
353
|
-
queries, file_result, version_result = self.process_file(processor, NodeFileProcessor.process_node_file, db_connector)
|
|
369
|
+
queries, file_result, version_result = self.process_file(processor, NodeFileProcessor.process_node_file, db_connector, file_count)
|
|
354
370
|
else:
|
|
355
|
-
queries, file_result, version_result = self.process_file(processor, NodeFileProcessor.process_node_file_batch, db_connector)
|
|
371
|
+
queries, file_result, version_result = self.process_file(processor, NodeFileProcessor.process_node_file_batch, db_connector, file_count)
|
|
356
372
|
case 'r':
|
|
357
373
|
if self.batch_rate == 0:
|
|
358
|
-
queries, file_result, version_result = self.process_file(processor, RelationshipFileProcessor.process_relationship_file, db_connector)
|
|
374
|
+
queries, file_result, version_result = self.process_file(processor, RelationshipFileProcessor.process_relationship_file, db_connector, file_count)
|
|
359
375
|
else:
|
|
360
|
-
queries, file_result, version_result = self.process_file(processor, RelationshipFileProcessor.process_relationship_file_batch, db_connector)
|
|
376
|
+
queries, file_result, version_result = self.process_file(processor, RelationshipFileProcessor.process_relationship_file_batch, db_connector, file_count)
|
|
361
377
|
case 'c' | 'pre-file' | 'post-file':
|
|
362
|
-
queries, file_result, version_result = self.process_file(processor, CypherFileProcessor.process_cypher_file, db_connector)
|
|
378
|
+
queries, file_result, version_result = self.process_file(processor, CypherFileProcessor.process_cypher_file, db_connector, file_count)
|
|
363
379
|
case 'q' | 'pre' | 'post':
|
|
364
|
-
queries, file_result, version_result = self.process_file(processor, CypherFileProcessor.process_query_list, db_connector)
|
|
380
|
+
queries, file_result, version_result = self.process_file(processor, CypherFileProcessor.process_query_list, db_connector, file_count)
|
|
365
381
|
case _:
|
|
366
382
|
# This should never happen!
|
|
367
383
|
queries = 0
|
|
@@ -376,7 +392,7 @@ class FileManager:
|
|
|
376
392
|
|
|
377
393
|
return num_queries
|
|
378
394
|
|
|
379
|
-
def process_file(self, file_to_process, file_processor, db_connector):
|
|
395
|
+
def process_file(self, file_to_process, file_processor, db_connector, file_count):
|
|
380
396
|
node_queries = 0
|
|
381
397
|
num_errors = 0
|
|
382
398
|
error_list = []
|
|
@@ -405,10 +421,11 @@ class FileManager:
|
|
|
405
421
|
else:
|
|
406
422
|
section = ''
|
|
407
423
|
|
|
424
|
+
file_message = f' {file_count} of {self.file_count}, "{file_to_process.get_filename()}"{section} at {amu.get_formatted_time_now()}'
|
|
408
425
|
if file_to_process.is_inline_query():
|
|
409
|
-
report_message(f'Processing query
|
|
426
|
+
report_message(f'Processing query{file_message}')
|
|
410
427
|
else:
|
|
411
|
-
report_message(f'Processing file
|
|
428
|
+
report_message(f'Processing file{file_message}')
|
|
412
429
|
# Build all the queries from the file, depending on the content type of the file
|
|
413
430
|
queries = file_processor(file_to_process)
|
|
414
431
|
message(f'{len(queries)} queries generated from {file_to_process.get_filename()}, processing...')
|
|
@@ -428,7 +445,7 @@ class FileManager:
|
|
|
428
445
|
|
|
429
446
|
try:
|
|
430
447
|
if self.min_display_rate:
|
|
431
|
-
display_rate = max(display_rate,int(ast.literal_eval(self.min_display_rate)))
|
|
448
|
+
display_rate = max(display_rate, int(ast.literal_eval(self.min_display_rate)))
|
|
432
449
|
except:
|
|
433
450
|
pass
|
|
434
451
|
else:
|
|
@@ -124,7 +124,7 @@ def strip_quotes(quote_list):
|
|
|
124
124
|
def merge_node_labels(merge_labels, node_labels):
|
|
125
125
|
wanted, _, remove = sort_labels(merge_labels, node_labels)
|
|
126
126
|
merged_labels = [i for i in merge_labels + wanted if not i in remove]
|
|
127
|
-
return merged_labels
|
|
127
|
+
return list(set(merged_labels))
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
def merge_labels(self, required_labels, unrequired_labels, remove_labels):
|
|
@@ -7,6 +7,7 @@ import processors.labelmanager as lm
|
|
|
7
7
|
import processors.propertymanager as pm
|
|
8
8
|
import property
|
|
9
9
|
from property import Neo4jProperty
|
|
10
|
+
import copy
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class NodeFileProcessor:
|
|
@@ -62,9 +63,9 @@ class NodeFileProcessor:
|
|
|
62
63
|
|
|
63
64
|
queries = []
|
|
64
65
|
|
|
65
|
-
num_rows = num_data_rows - self.start_from + 1
|
|
66
66
|
this_row = self.start_from-1
|
|
67
67
|
last_row = self.get_last_row(num_data_rows)
|
|
68
|
+
num_rows = last_row - self.start_from + 1
|
|
68
69
|
property_ref = 'n'
|
|
69
70
|
property_ref_dot = property_ref + '.'
|
|
70
71
|
|
|
@@ -79,10 +80,18 @@ class NodeFileProcessor:
|
|
|
79
80
|
# Split out those properties that are dependent on others, so that we can add them in the right order
|
|
80
81
|
explicit_properties, calculated_properties = pm.split_out_functional_properties(properties)
|
|
81
82
|
|
|
83
|
+
param_explicit_props = self.query_manager.parameterise_dict(explicit_properties, self.section)
|
|
84
|
+
param_calc_props = self.query_manager.parameterise_dict(calculated_properties, self.section)
|
|
85
|
+
|
|
86
|
+
param_properties = []
|
|
87
|
+
for count in range(max(len(param_explicit_props), len(param_calc_props))):
|
|
88
|
+
param_properties += [[param_explicit_props[min(count, len(param_explicit_props) - 1)], param_calc_props[min(count, len(param_calc_props) - 1)]]]
|
|
89
|
+
|
|
82
90
|
for primary_property in self.contents.get_property_values_list(this_row, node_columns, self.primary_property, allow_split=True, override_format='str'):
|
|
83
91
|
time_now = amu.get_formatted_time_now()
|
|
84
92
|
merge_labels, new_labels, remove_labels = lm.sort_node_labels(self.required_labels, validated_csv_labels)
|
|
85
93
|
node_labels = lm.merge_node_labels(merge_labels, primary_property.labels)
|
|
94
|
+
node_labels = lm.merge_node_labels(node_labels, new_labels)
|
|
86
95
|
|
|
87
96
|
# Build a simple MERGE query using queries
|
|
88
97
|
query_text = (QueryBuilder()
|
|
@@ -99,21 +108,24 @@ class NodeFileProcessor:
|
|
|
99
108
|
property_ref_dot + self.update_time_property + '=datetime("' + time_now + '")'
|
|
100
109
|
query_text = query_text.on_create().set_literal(create_time).set_literal(update_id)
|
|
101
110
|
|
|
102
|
-
if len(new_labels) > 0:
|
|
103
|
-
query_text = query_text.set_labels(ref_name=property_ref, labels=new_labels)
|
|
111
|
+
# if len(new_labels) > 0:
|
|
112
|
+
# query_text = query_text.set_labels(ref_name=property_ref, labels=new_labels)
|
|
104
113
|
if len(remove_labels) > 0:
|
|
105
114
|
query_text = query_text.remove_literal(f'{property_ref}:{":".join(remove_labels)}')
|
|
106
|
-
if len(explicit_properties) > 0:
|
|
107
|
-
query_text = query_text.set(properties=explicit_properties, property_ref=property_ref_dot)
|
|
108
|
-
if len(calculated_properties) > 0:
|
|
109
|
-
query_text = query_text.set(properties=calculated_properties, property_ref=property_ref_dot)
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
for props in param_properties:
|
|
117
|
+
query_text_param = query_text
|
|
118
|
+
param_explicit = props[0]
|
|
119
|
+
if len(param_explicit) > 0:
|
|
120
|
+
query_text_param = query_text_param.set(properties=param_explicit, property_ref=property_ref_dot)
|
|
121
|
+
param_calc = props[1]
|
|
122
|
+
if len(param_calc) > 0:
|
|
123
|
+
query_text_param = query_text_param.set(properties=param_calc, property_ref=property_ref_dot)
|
|
124
|
+
|
|
125
|
+
query_str = query_text_param.toStr()
|
|
126
|
+
query = Neo4jQuery('node', query_str, time_now, merge_labels, new_labels, primary_property, properties, self.section)
|
|
115
127
|
if self.validate_only and not self.summarise:
|
|
116
|
-
print(
|
|
128
|
+
print(query_str)
|
|
117
129
|
queries.append(query)
|
|
118
130
|
|
|
119
131
|
this_row += 1
|
|
@@ -134,9 +146,9 @@ class NodeFileProcessor:
|
|
|
134
146
|
|
|
135
147
|
queries = []
|
|
136
148
|
|
|
137
|
-
num_rows = num_data_rows - self.start_from + 1
|
|
138
149
|
this_row = self.start_from-1
|
|
139
150
|
last_row = self.get_last_row(num_data_rows)
|
|
151
|
+
num_rows = last_row - self.start_from + 1
|
|
140
152
|
dict_size = 0
|
|
141
153
|
property_ref = 'n'
|
|
142
154
|
property_ref_dot = property_ref + '.'
|
|
@@ -178,8 +190,6 @@ class NodeFileProcessor:
|
|
|
178
190
|
for count in range(max(len(param_explicit_props), len(param_calc_props))):
|
|
179
191
|
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]]
|
|
180
192
|
|
|
181
|
-
# prop_data = [explicit_properties, calculated_properties, time_now]
|
|
182
|
-
|
|
183
193
|
# So now we know all about this particular update. Let's put it in the query dictionary
|
|
184
194
|
# We'll group these by unique combinations of labels and primary key type
|
|
185
195
|
# Have to use a list since a dictionary key can't be a dictionary
|
|
@@ -217,8 +227,8 @@ class NodeFileProcessor:
|
|
|
217
227
|
while this_size < batch_size:
|
|
218
228
|
# Combine all the update data...
|
|
219
229
|
update = updates[(batch_num-1)*self.batch_rate + this_size]
|
|
220
|
-
update_properties = update[0] or {}
|
|
221
|
-
func_properties = update[1] or {}
|
|
230
|
+
update_properties = copy.copy(update[0]) or {}
|
|
231
|
+
func_properties = copy.copy(update[1]) or {}
|
|
222
232
|
if self.add_system_properties:
|
|
223
233
|
update_properties[self.update_time_property] = Neo4jProperty(self.update_time_property, update[2])
|
|
224
234
|
payload.append(update_properties)
|
|
@@ -233,18 +243,18 @@ class NodeFileProcessor:
|
|
|
233
243
|
property_count += len(a_payload)*len(formatted_pload)
|
|
234
244
|
|
|
235
245
|
# Build a MERGE query using queries
|
|
236
|
-
merge_labels = batch_keys[new_labels][1]
|
|
246
|
+
merge_labels = lm.merge_node_labels(batch_keys[new_labels][1], batch_keys[new_labels][0])
|
|
237
247
|
remove_labels = batch_keys[new_labels][2]
|
|
238
248
|
primary_property = batch_keys[new_labels][3][0]
|
|
239
249
|
query_text = (QueryBuilder()
|
|
240
250
|
.unwind_list_as(formatted_payload, payload_ref)
|
|
241
251
|
.merge()
|
|
242
|
-
.node_batch(labels=
|
|
252
|
+
.node_batch(labels=merge_labels, ref_name=property_ref, properties=primary_property+':'+payload_ref_dot+primary_property)
|
|
243
253
|
.set_literal(property_ref + ' += ' + payload_ref)
|
|
244
254
|
)
|
|
245
255
|
|
|
246
|
-
if batch_keys[new_labels][0]:
|
|
247
|
-
query_text = query_text.set_labels(ref_name=property_ref, labels=batch_keys[new_labels][0])
|
|
256
|
+
# if batch_keys[new_labels][0]:
|
|
257
|
+
# query_text = query_text.set_labels(ref_name=property_ref, labels=batch_keys[new_labels][0])
|
|
248
258
|
if len(remove_labels) > 0:
|
|
249
259
|
query_text = query_text.remove_literal(f'{property_ref}:{":".join(remove_labels)}')
|
|
250
260
|
if func_properties:
|