python-eigen-ingenuity 0.5.7b5__py3-none-any.whl → 0.5.9__py3-none-any.whl

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.
@@ -40,6 +40,7 @@ class ConfigManager:
40
40
  parser.add_argument('-sd', '--skipduplicates', action='store_true', help='Don\'t create a version node if there are no changes. Same as -nod')
41
41
  parser.add_argument('-nod', '--noduplicates', action='store_true', help='Don\'t create a version node if there are no changes. Same as -sd')
42
42
  parser.add_argument('-ab', '--allowblanks', nargs='*', default='', help='Update a node_key even if it is blank')
43
+ parser.add_argument('-rb', '--replaceblanks', default=None, type=str, help='Used in combination with allowblanks. Write a specific value instead of blank e.g "__NULL"')
43
44
  parser.add_argument('-b', '--batch', default=0, type=int, help='Number of queries to batch together when processing a node .csv file')
44
45
  parser.add_argument('-a', '--auth', action='store_true', help='Enable Azure Authentication')
45
46
  default_order = 'qnrc'
@@ -98,6 +99,7 @@ class ConfigManager:
98
99
  self.blank_properties_list = pm.validate_property_keys(blank_properties_list)
99
100
  else:
100
101
  self.blank_properties_list = ''
102
+ self.blank_properties_override = args.replaceblanks
101
103
  self.batch_rate = args.batch
102
104
  self.auth = args.auth
103
105
 
@@ -372,6 +374,9 @@ class ConfigManager:
372
374
 
373
375
  def get_blank_property_list(self):
374
376
  return self.blank_properties_list
377
+
378
+ def get_blank_property_override(self):
379
+ return self.blank_properties_override
375
380
 
376
381
  def get_batch_rate(self):
377
382
  return self.batch_rate
@@ -127,11 +127,13 @@ class CSVContentsManager:
127
127
  def get_property_values_dict(self, row_number, column_numbers, allow_blank_property_list, default_key='', prefix=''):
128
128
  this_row = self.data_list[row_number]
129
129
  split_values = [this_row[column].split('::') for column in column_numbers]
130
- this_list = {prefix + (self.mapped_keys[column] or default_key): Neo4jProperty(prefix + (self.mapped_keys[column] or default_key), this_row[column], self.formats[column]) if len(split_values[count]) == 1 else {prefix + split_values[count][0]: Neo4jProperty(prefix + split_values[count][0], split_values[count][1], self.formats[column])} for count, column in enumerate(column_numbers) if this_row[column] or self.mapped_keys[column] in allow_blank_property_list or allow_blank_property_list == []}
130
+ split_keys = [(split_values[count][0] + ':').split(':') for count, column in enumerate(column_numbers)]
131
+ this_list = {prefix + (self.mapped_keys[column] or default_key): Neo4jProperty(prefix + (self.mapped_keys[column] or default_key), this_row[column], self.formats[column]) if len(split_values[count]) == 1 else {prefix + (split_keys[count][0] or default_key): Neo4jProperty(prefix + (split_keys[count][0] or default_key), split_values[count][1], split_keys[count][1] or self.formats[column])} for count, column in enumerate(column_numbers) if this_row[column] or self.mapped_keys[column] in allow_blank_property_list or allow_blank_property_list == []}
131
132
  return this_list
132
133
 
133
134
  def get_property_values_list(self, row_number, column_numbers, default_key='', override_key=''):
134
135
  this_row = self.data_list[row_number]
135
136
  split_values = [this_row[column].split('::') for column in column_numbers]
136
- this_list = [Neo4jProperty((override_key or self.mapped_keys[column] or default_key), this_row[column], self.formats[column]) if len(split_values[count]) == 1 else Neo4jProperty(split_values[count][0], split_values[count][1], self.formats[column]) for count, column in enumerate(column_numbers) if this_row[column]]
137
+ split_keys = [(split_values[count][0]+':').split(':') for count, column in enumerate(column_numbers)]
138
+ this_list = [Neo4jProperty((override_key or self.mapped_keys[column] or default_key), this_row[column], self.formats[column]) if len(split_values[count]) == 1 else Neo4jProperty(split_keys[count][0] or default_key, split_values[count][1], split_keys[count][1] or self.formats[column]) for count, column in enumerate(column_numbers) if this_row[column]]
137
139
  return this_list
@@ -32,6 +32,7 @@ class NodeFileProcessor:
32
32
  self.summarise = config.in_summary_mode()
33
33
 
34
34
  self.blank_property_list = config.get_blank_property_list()
35
+ self.blank_property_override = config.get_blank_property_override()
35
36
  self.batch_rate = config.get_batch_rate()
36
37
  self.start_from = config.get_start_from()
37
38
  self.last_row = config.get_end_at()
@@ -70,7 +71,7 @@ class NodeFileProcessor:
70
71
  while this_row < last_row:
71
72
  validated_csv_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, label_columns))
72
73
  merge_labels, new_labels, remove_labels = lm.sort_node_labels(self.required_labels, validated_csv_labels)
73
- row_properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list)
74
+ row_properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list, self.blank_property_override)
74
75
  properties = pm.combine_properties(self.required_properties, row_properties)
75
76
  # Remove any properties we don't want
76
77
  for unwanted in self.unrequired_properties:
@@ -157,7 +158,7 @@ class NodeFileProcessor:
157
158
  while this_row < last_row:
158
159
  validated_csv_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, label_columns))
159
160
  merge_labels, new_labels, remove_labels = lm.sort_node_labels(self.required_labels, validated_csv_labels)
160
- row_properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list)
161
+ row_properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list, self.blank_property_override)
161
162
 
162
163
  for primary_property in self.contents.get_property_values_list(this_row, node_columns, self.primary_property):
163
164
  properties = pm.combine_properties(self.required_properties, row_properties)
@@ -226,8 +227,8 @@ class NodeFileProcessor:
226
227
  # Build a MERGE query using queries
227
228
  merge_labels = batch_keys[new_labels][1]
228
229
  remove_labels = batch_keys[new_labels][2]
229
- if batch_keys[new_labels][0]:
230
- merge_labels += batch_keys[new_labels][0]
230
+ # if batch_keys[new_labels][0]:
231
+ # merge_labels += batch_keys[new_labels][0]
231
232
  primary_property = batch_keys[new_labels][3][0]
232
233
  query_text = (QueryBuilder()
233
234
  .unwind_list_as(formatted_payload, payload_ref)
@@ -235,6 +236,9 @@ class NodeFileProcessor:
235
236
  .node_batch(labels=list(set(merge_labels)), ref_name=property_ref, properties=primary_property+':'+payload_ref_dot+primary_property)
236
237
  .set_literal(property_ref + ' += ' + payload_ref)
237
238
  )
239
+
240
+ if batch_keys[new_labels][0]:
241
+ query_text = query_text.set_labels(ref_name=property_ref, labels=batch_keys[new_labels][0])
238
242
  if len(remove_labels) > 0:
239
243
  query_text = query_text.remove_literal(f'{property_ref}:{":".join(remove_labels)}')
240
244
  if func_properties:
@@ -31,6 +31,7 @@ class RelationshipFileProcessor:
31
31
  self.validate_only = config.in_validation_mode()
32
32
  self.summarise = config.in_summary_mode()
33
33
 
34
+ self.blank_property_override = config.get_blank_property_override()
34
35
  self.blank_property_list = config.get_blank_property_list()
35
36
  self.batch_rate = config.get_batch_rate()
36
37
  self.start_from = config.get_start_from()
@@ -77,7 +78,7 @@ class RelationshipFileProcessor:
77
78
 
78
79
  relationships = rm.validate_relationships(self.contents.get_column_values_list(this_row, relation_columns))
79
80
 
80
- properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list)
81
+ properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list, self.blank_property_override)
81
82
  # If there are multiple From or To nodes, create a relationship query for each combination
82
83
  for from_node in self.contents.get_property_values_list(this_row, from_columns, self.primary_property, self.primary_property):
83
84
  validated_csv_from_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, from_label_columns))
@@ -164,7 +165,7 @@ class RelationshipFileProcessor:
164
165
  last_row = self.get_last_row(num_data_rows)
165
166
  while this_row < last_row:
166
167
  relationships = rm.validate_relationships(self.contents.get_column_values_list(this_row, relation_columns))
167
- properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list)
168
+ properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list, self.blank_property_override)
168
169
  # If there are multiple From or To nodes, create a relationship query for each combination
169
170
  for from_node in self.contents.get_property_values_list(this_row, from_columns, self.primary_property, self.primary_property):
170
171
  validated_csv_from_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, from_label_columns))
@@ -5,16 +5,23 @@ import processors.propertymanager as pm
5
5
 
6
6
  class Neo4jProperty():
7
7
 
8
- def __init__(self, key, value = None, format = None, type = None):
8
+ def __init__(self, key, value = None, format = None, type = None, blank_override = False):
9
9
 
10
- # print(f'k: {key}')
11
- # print(f'f: {format}')
12
- # print(f'v: {value}')
13
- # print(f't: {type}')
10
+ # print(f'k: {key}')
11
+ # print(f'f: {format}')
12
+ # print(f'v: {value}')
13
+ # print(f't: {type}')
14
14
 
15
15
  self.key = pm.validate_property(key)
16
16
  # Sanitise the value
17
17
  self.value = value.replace('\\', '\\\\').replace('\r', '\\r').replace('\n', '\\n').replace('"', '\\"')
18
+
19
+ if self.value == "":
20
+ if blank_override:
21
+ self.value = blank_override
22
+ else:
23
+ self.value = "''"
24
+
18
25
  # format is the data type e.g. int, str, bool
19
26
  self.format = format
20
27
  # type is the kind of thing this is, such as ID, START_ID etc. See assetmodelutilities.py for the full list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-eigen-ingenuity
3
- Version: 0.5.7b5
3
+ Version: 0.5.9
4
4
  Summary: A python library used to query data from the Eigen Ingenuity system
5
5
  Home-page: https://www.eigen.co/
6
6
  Author: Murray Callander
@@ -16,8 +16,8 @@ Requires-Dist: msal
16
16
  Requires-Dist: cryptography
17
17
  Requires-Dist: keyring
18
18
  Requires-Dist: pyarrow
19
- Requires-Dist: neo4j >=5.17.0
20
- Requires-Dist: requests >=2.31.0
19
+ Requires-Dist: neo4j>=5.17.0
20
+ Requires-Dist: requests>=2.31.0
21
21
  Requires-Dist: dateparser
22
22
 
23
23
  CONTENTS <!-- omit in toc -->
@@ -15,13 +15,13 @@ modelbuilder/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
15
15
  modelbuilder/src/assetmodelbuilder.py,sha256=TtIkaPXoe7uSdBg3H67ZsJsjuWEiZJGHXNpEgjX_IXE,8256
16
16
  modelbuilder/src/assetmodelcsvwriter.py,sha256=GKNi_fw7AlY-UG2XhwFIS34Ff3XiVRss-o5MUzyJSV0,1071
17
17
  modelbuilder/src/assetmodelutilities.py,sha256=KwyP8-2EfpRHKmGasPJLV74EGYBjSHgxHBAy8xuvh6k,1743
18
- modelbuilder/src/configmanager.py,sha256=M42_rUYBtGyEYtnRAvtspFS9oCtNEn3KumlA-cGbOPM,24690
19
- modelbuilder/src/csvcontentsmanager.py,sha256=9mssfWQn_KZf4lzilVZqAgfe9_O-X1vgFWnDGSFYTeA,6614
18
+ modelbuilder/src/configmanager.py,sha256=WWg6XHmBYBoQkDJ7ZcLWe1uX93trULe1xjXetcxMKMY,25021
19
+ modelbuilder/src/csvcontentsmanager.py,sha256=_JpgJw65o2no5jGfJsfSdCVX88OIIX6NZQFTYcveJ54,6927
20
20
  modelbuilder/src/csvwriter.py,sha256=m2XVbyZq3Gq2bb36HqvOFuTuet1fi1nRPURL6yEtfjI,14051
21
21
  modelbuilder/src/fileanalyser.py,sha256=yz7WFIMmeZ2Oh1SFGmdIzl9p8rflOrx3xoEUp5bESD4,3781
22
22
  modelbuilder/src/filemanager.py,sha256=dFSVc7ciI9EfViyk6z2WmWMDTIvLJgVSU9XRsqTNfxg,22021
23
23
  modelbuilder/src/messages.py,sha256=6JnW-ke6nHGUA4hTEBvo_kVlNJTXoV4LWw8mNwMpBCQ,1325
24
- modelbuilder/src/property.py,sha256=yOURGVjmP5naiiQEfpErmEheC1UDojKMRONhMnwl6ug,12013
24
+ modelbuilder/src/property.py,sha256=XCXHlBiEUa4U0rZnrNHqFmzrpiiGCeMjKQtS2qgiuWI,12201
25
25
  modelbuilder/src/versionmanager.py,sha256=SRbhre0VH3Z8d-S1rbMjLauYvzydNY6v_glM0nQarPI,19272
26
26
  modelbuilder/src/connectors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  modelbuilder/src/connectors/boltconnector.py,sha256=N4hNEXzRWkPgDrRi49tgUdYw_y4ODu-mZUS3AiYAH7k,4579
@@ -31,16 +31,16 @@ modelbuilder/src/connectors/httpsconnector.py,sha256=06TrQSEa5bmqXjPPAqz1hXrOEOw
31
31
  modelbuilder/src/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  modelbuilder/src/processors/cypherfileprocessor.py,sha256=Y77GddRVhQKNhs6V4jfqwE2LhZvINZ1NX0a_lRadlds,2868
33
33
  modelbuilder/src/processors/labelmanager.py,sha256=03fD-JXjdeEyHXUeihst5rVWgmd-3-Y8fSMM42OfsT8,6237
34
- modelbuilder/src/processors/nodefileprocessor.py,sha256=7wpFS8bEZBGTupqmXpKJRs4fNy5HFb3VkaKCtNWW2os,13329
34
+ modelbuilder/src/processors/nodefileprocessor.py,sha256=zxihfH3fIqIBJe__pICcwc7NjEBzDBxQfWWG87MZCHk,13626
35
35
  modelbuilder/src/processors/propertymanager.py,sha256=8l9Wc3hirdiTLsrGNXzxWGn-D3z7yHRtJDVKIfQtc-8,6633
36
- modelbuilder/src/processors/relationshipfileprocessor.py,sha256=M-VP316_gZcif0MgVhCtUuV8RJXJDM9eYPSa5gzr6WU,15475
36
+ modelbuilder/src/processors/relationshipfileprocessor.py,sha256=Ym4KzvyFwFuUUjFHIAHmLzAfb2OElxxILg6ZZN8jeIM,15611
37
37
  modelbuilder/src/processors/relationshipmanager.py,sha256=lDtE_5AdKzL3boq7VD8Gmpai8Uscq79vRxkzYQL8A9A,1105
38
38
  modelbuilder/src/queries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  modelbuilder/src/queries/cypherbuilder.py,sha256=_CIb2eQSa1N23m3ebzoCF-W9DPvKoRHAIF9wyt1EuV4,10715
40
40
  modelbuilder/src/queries/query.py,sha256=fEkGv49yxeL0Sz5bMmC3-Dt0_9qoZBz37hsTY8pQVIA,2568
41
41
  modelbuilder/src/queries/typedefs.py,sha256=JebIVlrLHylhisziGgG2YOJcTapT2tyVc3PsqeHw0RU,10437
42
- python_eigen_ingenuity-0.5.7b5.dist-info/METADATA,sha256=sR4PjGoxfhlzJ1esRDMLbGP93QVf0J6DHhfzSHaK-fE,38190
43
- python_eigen_ingenuity-0.5.7b5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
44
- python_eigen_ingenuity-0.5.7b5.dist-info/entry_points.txt,sha256=G3LjFQX5xKaN4mqtqCL8uaC-gRbP5T5x9r0gBTJTXXA,70
45
- python_eigen_ingenuity-0.5.7b5.dist-info/top_level.txt,sha256=lFiZ43CY_1bmdtRidIXbA6rrY2d92Rs-9tH8pcgI-XU,28
46
- python_eigen_ingenuity-0.5.7b5.dist-info/RECORD,,
42
+ python_eigen_ingenuity-0.5.9.dist-info/METADATA,sha256=AQRmTbQZEOCwDW4SdDnUOGRDCpwYycb4uI-BHSFXORk,38186
43
+ python_eigen_ingenuity-0.5.9.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
44
+ python_eigen_ingenuity-0.5.9.dist-info/entry_points.txt,sha256=G3LjFQX5xKaN4mqtqCL8uaC-gRbP5T5x9r0gBTJTXXA,70
45
+ python_eigen_ingenuity-0.5.9.dist-info/top_level.txt,sha256=lFiZ43CY_1bmdtRidIXbA6rrY2d92Rs-9tH8pcgI-XU,28
46
+ python_eigen_ingenuity-0.5.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5