pyegeria 5.4.0.dev3__py3-none-any.whl → 5.4.0.dev6__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.
- commands/cat/dr_egeria_md.py +12 -3
- commands/cat/list_collections.py +7 -6
- commands/cat/list_data_designer.py +20 -9
- md_processing/__init__.py +4 -1
- md_processing/data/commands.json +142 -17
- md_processing/md_commands/data_designer_commands.py +408 -101
- md_processing/md_commands/glossary_commands.py +0 -30
- md_processing/md_commands/solution_architect_commands.py +1 -1
- md_processing/md_processing_utils/common_md_proc_utils.py +16 -4
- md_processing/md_processing_utils/md_processing_constants.py +3 -1
- pyegeria/collection_manager_omvs.py +120 -72
- pyegeria/data_designer_omvs.py +161 -60
- pyegeria/glossary_browser_omvs.py +5 -6
- pyegeria/output_formatter.py +33 -14
- pyegeria/solution_architect_omvs.py +277 -9
- {pyegeria-5.4.0.dev3.dist-info → pyegeria-5.4.0.dev6.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.dev3.dist-info → pyegeria-5.4.0.dev6.dist-info}/RECORD +20 -58
- commands/cat/.DS_Store +0 -0
- commands/cat/debug_log.2025-06-05_20-24-18_123924.log.zip +0 -0
- commands/cat/debug_log.2025-06-10_08-45-03_929921.log.zip +0 -0
- commands/cat/debug_log.2025-06-11_09-57-21_247890.log.zip +0 -0
- commands/cat/debug_log.2025-06-12_16-14-31_212042.log.zip +0 -0
- commands/cat/debug_log.log +0 -1267
- commands/cat/solution_architect_log.log +0 -0
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +0 -254
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +0 -696
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +0 -254
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +0 -298
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +0 -608
- md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +0 -94
- md_processing/dr_egeria_inbox/archive/freddie_intro.md +0 -284
- md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +0 -275
- md_processing/dr_egeria_inbox/archive/test-term.md +0 -110
- md_processing/dr_egeria_inbox/cat_test.md +0 -100
- md_processing/dr_egeria_inbox/data_designer_search_test.md +0 -11
- md_processing/dr_egeria_inbox/data_field.md +0 -54
- md_processing/dr_egeria_inbox/data_spec.md +0 -77
- md_processing/dr_egeria_inbox/data_spec_test.md +0 -2406
- md_processing/dr_egeria_inbox/data_test.md +0 -179
- md_processing/dr_egeria_inbox/data_test2.md +0 -376
- md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +0 -168
- md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +0 -280
- md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +0 -313
- md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +0 -1073
- md_processing/dr_egeria_inbox/dr_egeria_isc1.md +0 -44
- md_processing/dr_egeria_inbox/glossary_search_test.md +0 -40
- md_processing/dr_egeria_inbox/glossary_test1.md +0 -324
- md_processing/dr_egeria_inbox/rel.md +0 -8
- md_processing/dr_egeria_inbox/sb.md +0 -119
- md_processing/dr_egeria_inbox/solution-components.md +0 -129
- md_processing/dr_egeria_inbox/solution_blueprints.md +0 -118
- md_processing/dr_egeria_inbox/synonym_test.md +0 -42
- md_processing/dr_egeria_inbox/t1.md +0 -0
- md_processing/dr_egeria_inbox/t2.md +0 -268
- pyegeria/.DS_Store +0 -0
- {pyegeria-5.4.0.dev3.dist-info → pyegeria-5.4.0.dev6.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.dev3.dist-info → pyegeria-5.4.0.dev6.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.dev3.dist-info → pyegeria-5.4.0.dev6.dist-info}/entry_points.txt +0 -0
@@ -2,7 +2,7 @@
|
|
2
2
|
This file contains term-related object_action functions for processing Egeria Markdown
|
3
3
|
"""
|
4
4
|
import json
|
5
|
-
import sys
|
5
|
+
import sys, os
|
6
6
|
from typing import Optional
|
7
7
|
|
8
8
|
from loguru import logger
|
@@ -17,6 +17,26 @@ from md_processing.md_processing_utils.md_processing_constants import (load_comm
|
|
17
17
|
from pyegeria import DEBUG_LEVEL, body_slimmer
|
18
18
|
from pyegeria.egeria_tech_client import EgeriaTech
|
19
19
|
|
20
|
+
|
21
|
+
GERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
22
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
23
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
24
|
+
EGERIA_VIEW_SERVER = os.environ.get("EGERIA_VIEW_SERVER", "view-server")
|
25
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get("EGERIA_VIEW_SERVER_URL", "https://localhost:9443")
|
26
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("EGERIA_INTEGRATION_DAEMON", "integration-daemon")
|
27
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get("EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443")
|
28
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
29
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
30
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
31
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
32
|
+
EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 220)
|
33
|
+
EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
|
34
|
+
EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
|
35
|
+
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
36
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "../../")
|
37
|
+
EGERIA_INBOX_PATH = os.environ.get("EGERIA_INBOX_PATH", "md_processing/dr_egeria_inbox")
|
38
|
+
EGERIA_OUTBOX_PATH = os.environ.get("EGERIA_OUTBOX_PATH", "md_processing/dr_egeria_outbox")
|
39
|
+
|
20
40
|
load_commands('commands.json')
|
21
41
|
debug_level = DEBUG_LEVEL
|
22
42
|
|
@@ -24,8 +44,11 @@ console = Console(width=int(200))
|
|
24
44
|
|
25
45
|
log_format = "D {time} | {level} | {function} | {line} | {message} | {extra}"
|
26
46
|
logger.remove()
|
27
|
-
logger.add(sys.stderr, level="
|
28
|
-
|
47
|
+
logger.add(sys.stderr, level="ERROR", format=log_format, colorize=True)
|
48
|
+
full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, "data_designer_debug.log")
|
49
|
+
# logger.add(full_file_path, rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
50
|
+
# colorize=True)
|
51
|
+
logger.add("debug_log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
29
52
|
colorize=True)
|
30
53
|
|
31
54
|
|
@@ -43,10 +66,13 @@ def add_member_to_data_collections(egeria_client: EgeriaTech, collection_list: l
|
|
43
66
|
"notes": "Added by Dr.Egeria"
|
44
67
|
}
|
45
68
|
try:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
69
|
+
if collection_list is not None:
|
70
|
+
for collection in collection_list:
|
71
|
+
egeria_client.add_to_collection(collection, guid, body)
|
72
|
+
msg = f"Added `{display_name}` member to `{collection}`"
|
73
|
+
logger.info(msg)
|
74
|
+
else:
|
75
|
+
logger.info("There were no data collections to add.")
|
50
76
|
return
|
51
77
|
|
52
78
|
except Exception as e:
|
@@ -90,8 +116,8 @@ def update_data_collection_memberships(egeria_client: EgeriaTech, entity_type: s
|
|
90
116
|
|
91
117
|
coll_list = egeria_client.get_data_memberships(get_command, guid)
|
92
118
|
if coll_list is None:
|
93
|
-
logger.
|
94
|
-
|
119
|
+
logger.warning("Unexpected -> the collection list was None - assigning empty dict")
|
120
|
+
coll_list = {}
|
95
121
|
# compare the existing collections to desired collections
|
96
122
|
if collection_class == "DataDictionary":
|
97
123
|
as_is = set(coll_list.get("DictList", {}))
|
@@ -163,9 +189,17 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
163
189
|
TODO: Need to add data class support when ready and may need to revisit bodies.
|
164
190
|
|
165
191
|
"""
|
192
|
+
if terms:
|
193
|
+
terms = [terms]
|
194
|
+
|
166
195
|
if replace_all_props:
|
167
196
|
rel_el_list = egeria_client.get_data_field_rel_elements(guid)
|
168
197
|
# should I throw an exception if empty?
|
198
|
+
if rel_el_list is None:
|
199
|
+
logger.warning("Unexpected -> the list was None - assigning empty list")
|
200
|
+
rel_el_list = {}
|
201
|
+
|
202
|
+
|
169
203
|
as_is_data_structs = set(rel_el_list.get("data_structure_guids", []))
|
170
204
|
as_is_parent_fields = set(rel_el_list.get("parent_guids", []))
|
171
205
|
as_is_assigned_meanings = set(rel_el_list.get("assigned_meanings_guids", []))
|
@@ -174,7 +208,7 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
174
208
|
to_be_data_structs = set(structure_list) if structure_list is not None else set()
|
175
209
|
to_be_parent_fields = set(parent_field_list) if parent_field_list is not None else set()
|
176
210
|
to_be_assigned_meanings = set(terms) if terms is not None else set()
|
177
|
-
to_be_data_classes = set(data_class_guid) if data_class_guid is not None else set()
|
211
|
+
to_be_data_classes = set([data_class_guid]) if data_class_guid is not None else set()
|
178
212
|
|
179
213
|
logger.trace(f"as_is_data_structs: {list(as_is_data_structs)} to_be_data_struct: {list(to_be_data_structs)}")
|
180
214
|
logger.trace(
|
@@ -216,7 +250,7 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
216
250
|
|
217
251
|
terms_to_remove = as_is_assigned_meanings - to_be_assigned_meanings
|
218
252
|
logger.trace(f"terms_to_remove: {list(terms_to_remove)}")
|
219
|
-
if
|
253
|
+
if terms:
|
220
254
|
for term in terms_to_remove:
|
221
255
|
egeria_client.detach_semantic_definition(guid, term, None)
|
222
256
|
msg = f"Removed `{term}` from `{display_name}`"
|
@@ -233,94 +267,160 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
233
267
|
logger.trace(f"classes_to_remove: {list(classes_to_remove)}")
|
234
268
|
if len(terms_to_remove) > 0:
|
235
269
|
for dc in classes_to_remove:
|
236
|
-
|
270
|
+
body = {
|
271
|
+
"class": "MetadataSourceRequestBody",
|
272
|
+
"forLineage": False,
|
273
|
+
"forDuplicateProcessing": False
|
274
|
+
}
|
275
|
+
egeria_client.detach_data_class_definition(guid, dc, body)
|
237
276
|
msg = f"Removed `{dc}` from `{display_name}`"
|
238
277
|
logger.trace(msg)
|
239
278
|
classes_to_add = to_be_data_classes - as_is_data_classes
|
240
279
|
logger.trace(f"classes_to_add: {list(classes_to_add)}")
|
241
280
|
if len(terms_to_add) > 0:
|
242
281
|
for dc in classes_to_add:
|
243
|
-
|
282
|
+
body = {
|
283
|
+
"class": "RelationshipRequestBody",
|
284
|
+
"forLineage": False,
|
285
|
+
"forDuplicateProcessing": False
|
286
|
+
}
|
287
|
+
egeria_client.link_data_class_definition(guid, dc, body)
|
244
288
|
msg = f"Added `{dc}` to`{display_name}`"
|
245
289
|
logger.trace(msg)
|
246
290
|
|
247
291
|
|
248
292
|
else: # merge - add field to related elements
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
for field in parent_field_list:
|
254
|
-
egeria_client.link_nested_data_field(field, guid, None)
|
255
|
-
msg = f"Added `{display_name}` to `{field}`"
|
256
|
-
logger.trace(msg)
|
257
|
-
for term in terms:
|
258
|
-
egeria_client.link_semantic_definition(guid, term, None)
|
259
|
-
msg = f"Added `{term}` to `{display_name}`"
|
293
|
+
if structure_list:
|
294
|
+
add_field_to_data_structures(egeria_client, display_name, structure_list, guid)
|
295
|
+
msg = f"Added `{display_name}` to `{structure_list}`"
|
260
296
|
logger.trace(msg)
|
261
297
|
|
262
|
-
|
263
|
-
|
264
|
-
|
298
|
+
if parent_field_list:
|
299
|
+
for field in parent_field_list:
|
300
|
+
egeria_client.link_nested_data_field(field, guid, None)
|
301
|
+
msg = f"Added `{display_name}` to `{field}`"
|
302
|
+
logger.trace(msg)
|
303
|
+
if terms:
|
304
|
+
for term in terms:
|
305
|
+
egeria_client.link_semantic_definition(guid, term, None)
|
306
|
+
msg = f"Added `{term}` to `{display_name}`"
|
307
|
+
logger.trace(msg)
|
308
|
+
|
309
|
+
if data_class_guid:
|
310
|
+
egeria_client.link_data_class_definition(guid, data_class_guid)
|
311
|
+
msg = f"Added `{data_class_guid}` to `{display_name}`"
|
312
|
+
logger.trace(msg)
|
265
313
|
|
266
314
|
|
267
315
|
@logger.catch
|
268
316
|
def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_class_guids: list, terms: list,
|
269
|
-
|
317
|
+
specializes_data_classes: list, guid: str, display_name: str,
|
270
318
|
replace_all_props: bool = True) -> None:
|
271
319
|
"""Sync a data class' related elements.
|
272
320
|
|
273
|
-
TODO: may need to revisit bodies.
|
274
|
-
|
275
321
|
"""
|
322
|
+
if terms:
|
323
|
+
terms = [terms]
|
324
|
+
|
276
325
|
if replace_all_props:
|
277
|
-
rel_el_list = egeria_client.
|
278
|
-
|
279
|
-
|
280
|
-
|
326
|
+
rel_el_list = egeria_client.get_data_class_rel_elements(guid)
|
327
|
+
if rel_el_list is None:
|
328
|
+
logger.warning("Unexpected -> the list was None - assigning empty list")
|
329
|
+
rel_el_list = {}
|
330
|
+
if terms:
|
331
|
+
terms = [terms]
|
332
|
+
|
333
|
+
as_is_nested_classes = set(rel_el_list.get("nested_data_class_guids", []))
|
281
334
|
as_is_assigned_meanings = set(rel_el_list.get("assigned_meanings_guids", []))
|
282
|
-
|
335
|
+
as_is_specialized_classes = set(rel_el_list.get("specialized_data_class_guids", []))
|
336
|
+
|
337
|
+
to_be_nested_classes = set(containing_data_class_guids) if containing_data_class_guids is not None else set()
|
338
|
+
to_be_assigned_meanings = set(terms) if terms is not None else set()
|
339
|
+
to_be_specialized_classes = set([specializes_data_classes]) if specializes_data_classes is not None else set()
|
340
|
+
|
341
|
+
logger.trace(
|
342
|
+
f"as_is_nested_classes: {list(as_is_nested_classes)} to_be_nested_classes: {list(to_be_nested_classes)}")
|
343
|
+
logger.trace(f"as_is_assigned_meanings: {list(as_is_assigned_meanings)} to_be_assigned_meanings: "
|
344
|
+
f"{list(to_be_assigned_meanings)}")
|
345
|
+
logger.trace(f"as_is_specialized_classes: {list(as_is_specialized_classes)} to_be_specizialized_data_classes: "
|
346
|
+
f"{list(to_be_specialized_classes)}")
|
347
|
+
|
348
|
+
|
349
|
+
nested_classes_to_remove = to_be_nested_classes - as_is_nested_classes
|
350
|
+
logger.trace(f"nested_classes_to_remove: {list(nested_classes_to_remove)}")
|
351
|
+
if len(nested_classes_to_remove) > 0:
|
352
|
+
for field in nested_classes_to_remove:
|
353
|
+
egeria_client.detach_nested_data_class(field, guid, None)
|
354
|
+
msg = f"Removed `{display_name}` from field `{field}`"
|
355
|
+
logger.trace(msg)
|
356
|
+
nested_classes_to_add = to_be_nested_classes - as_is_nested_classes
|
357
|
+
logger.trace(f"nested_classes_to_add: {list(nested_classes_to_add)}")
|
358
|
+
if len(nested_classes_to_add) > 0:
|
359
|
+
for field in nested_classes_to_add:
|
360
|
+
egeria_client.link_nested_data_class(field, guid, None)
|
361
|
+
msg = f"Added `{display_name}` to field `{field}`"
|
362
|
+
logger.trace(msg)
|
363
|
+
|
364
|
+
terms_to_remove = as_is_assigned_meanings - to_be_assigned_meanings
|
365
|
+
logger.trace(f"terms_to_remove: {list(terms_to_remove)}")
|
366
|
+
if len(terms_to_remove) > 0:
|
367
|
+
for term in terms_to_remove:
|
368
|
+
egeria_client.detach_semantic_definition(guid, term, None)
|
369
|
+
msg = f"Removed `{term}` from `{display_name}`"
|
370
|
+
logger.trace(msg)
|
371
|
+
terms_to_add = to_be_assigned_meanings - as_is_assigned_meanings
|
372
|
+
logger.trace(f"terms_to_add: {list(terms_to_add)}")
|
373
|
+
if len(terms_to_add) > 0:
|
374
|
+
for term in terms_to_add:
|
375
|
+
egeria_client.link_semantic_definition(guid, term, None)
|
376
|
+
msg = f"Added `{term}` to`{display_name}`"
|
377
|
+
logger.trace(msg)
|
378
|
+
|
379
|
+
specialized_classes_to_remove = as_is_specialized_classes - to_be_specialized_classes
|
380
|
+
logger.trace(f"classes_to_remove: {list(specialized_classes_to_remove)}")
|
381
|
+
if len(terms_to_remove) > 0:
|
382
|
+
for dc in specialized_classes_to_remove:
|
383
|
+
body = {
|
384
|
+
"class": "MetadataSourceRequestBody",
|
385
|
+
"forLineage": False,
|
386
|
+
"forDuplicateProcessing": False
|
387
|
+
}
|
388
|
+
egeria_client.detach_specialist_data_class(guid, dc, body)
|
389
|
+
msg = f"Removed `{dc}` from `{display_name}`"
|
390
|
+
logger.trace(msg)
|
391
|
+
specialized_classes_to_add = to_be_specialized_classes - as_is_specialized_classes
|
392
|
+
logger.trace(f"classes_to_add: {list(specialized_classes_to_add)}")
|
393
|
+
if len(specialized_classes_to_add) > 0:
|
394
|
+
for dc in specialized_classes_to_add:
|
395
|
+
body = {
|
396
|
+
"class": "RelationshipRequestBody",
|
397
|
+
"forLineage": False,
|
398
|
+
"forDuplicateProcessing": False
|
399
|
+
}
|
400
|
+
egeria_client.link_specialist_data_class(guid, dc, body)
|
401
|
+
msg = f"Added `{dc}` to`{display_name}`"
|
402
|
+
logger.trace(msg)
|
403
|
+
|
404
|
+
|
405
|
+
else: # merge - add field to related elements
|
406
|
+
if containing_data_class_guids:
|
407
|
+
for field in containing_data_class_guids:
|
408
|
+
egeria_client.link_nested_data_class(field, guid, None)
|
409
|
+
msg = f"Added `{display_name}` to `{field}`"
|
410
|
+
logger.trace(msg)
|
411
|
+
|
412
|
+
if terms:
|
413
|
+
for term in terms:
|
414
|
+
egeria_client.link_semantic_definition(guid, term, None)
|
415
|
+
msg = f"Added `{term}` to `{display_name}`"
|
416
|
+
logger.trace(msg)
|
417
|
+
if specializes_data_classes:
|
418
|
+
for el in specializes_data_classes:
|
419
|
+
egeria_client.link_specialist_data_class(guid, el)
|
420
|
+
msg = f"Linked `{el}` to `{display_name}`"
|
421
|
+
logger.trace(msg)
|
422
|
+
|
283
423
|
|
284
|
-
# to_be_data_structs = set(structure_list) if structure_list is not None else set() #
|
285
|
-
# to_be_parent_fields = set(parent_field_list) if parent_field_list is not None else set() #
|
286
|
-
# to_be_assigned_meanings = set(terms) if data_class_list is not None else set() #
|
287
|
-
# to_be_assigned_data_classes = set(data_class_list) if data_class_list is not None else set() # #
|
288
|
-
# logger.trace(f"as_is_data_structs: {list(as_is_data_structs)} to_be_data_struct: {list(
|
289
|
-
# to_be_data_structs)}") # logger.trace( # f"as_is_parent_fields: {list(as_is_parent_fields)}
|
290
|
-
# to_be_parent_fields: {list(to_be_parent_fields)}") # logger.trace( #
|
291
|
-
# f"as_is_assigned_meanings: {list(as_is_assigned_meanings)} to_be_assigned_meanings: " # f"{list(
|
292
|
-
# to_be_assigned_meanings)}") # logger.trace( # f"as_is_data_classes: {list(
|
293
|
-
# as_is_data_classes)} to_be_assigned_data_classes: " # f"{list(to_be_assigned_data_classes)}") #
|
294
|
-
# data_struct_to_remove = as_is_data_structs - to_be_data_structs # logger.trace(
|
295
|
-
# f"data_struct_to_remove: {list(data_struct_to_remove)}") # if len(data_struct_to_remove) > 0: #
|
296
|
-
# for ds in data_struct_to_remove: # egeria_client.detach_member_data_field(ds, guid,
|
297
|
-
# None) # msg = f"Removed `{display_name}` from structure `{ds}`" # logger.trace(
|
298
|
-
# msg) # data_struct_to_add = to_be_data_structs - as_is_data_structs # logger.trace(
|
299
|
-
# f"data_struct_to_add: {list(data_struct_to_add)}") # if len(data_struct_to_add) > 0: # for ds
|
300
|
-
# in data_struct_to_add: # egeria_client.link_member_data_field(ds, guid, None) #
|
301
|
-
# msg = f"Added `{display_name}` to structure `{ds}`" # logger.trace(msg) # #
|
302
|
-
# parent_field_to_remove = to_be_parent_fields - as_is_parent_fields # logger.trace(
|
303
|
-
# f"parent_field_to_remove: {list(parent_field_to_remove)}") # if len(parent_field_to_remove) > 0: #
|
304
|
-
# for field in parent_field_to_remove: # egeria_client.detach_nested_data_field(field, guid,
|
305
|
-
# None) # msg = f"Removed `{display_name}` from field `{field}`" # logger.trace(
|
306
|
-
# msg) # parent_field_to_add = to_be_parent_fields - as_is_parent_fields # logger.trace(
|
307
|
-
# f"parent_field_to_add: {list(parent_field_to_add)}") # if len(parent_field_to_add) > 0: # for
|
308
|
-
# field in parent_field_to_add: # egeria_client.link_nested_data_field(field, guid, None) #
|
309
|
-
# msg = f"Added `{display_name}` to field `{field}`" # logger.trace(msg) # #
|
310
|
-
# terms_to_remove = as_is_assigned_meanings - to_be_assigned_meanings # logger.trace(f"terms_to_remove:
|
311
|
-
# {list(terms_to_remove)}") # if len(terms_to_remove) > 0: # for term in terms_to_remove: #
|
312
|
-
# egeria_client.detach_semantic_definition(guid, term, None) # msg = f"Removed `{term}` from `{
|
313
|
-
# display_name}`" # logger.trace(msg) # terms_to_add = to_be_assigned_meanings -
|
314
|
-
# as_is_assigned_meanings # logger.trace(f"terms_to_add: {list(terms_to_add)}") # if len(
|
315
|
-
# terms_to_add) > 0: # for term in terms_to_add: #
|
316
|
-
# egeria_client.link_semantic_definition(guid, term, None) # msg = f"Added `{term}` to`{
|
317
|
-
# display_name}`" # logger.trace(msg) # # else: # merge - add field to related elements #
|
318
|
-
# add_field_to_data_structures(egeria_client, display_name, structure_list, guid) # msg = f"Added `{
|
319
|
-
# display_name}` to `{structure_list}`" # logger.trace(msg) # # for field in parent_field_list: #
|
320
|
-
# egeria_client.link_nested_data_field(field, guid, None) # msg = f"Added `{display_name}` to `{
|
321
|
-
# field}`" # logger.trace(msg) # for term in terms: #
|
322
|
-
# egeria_client.link_semantic_definition(guid, term, None) # msg = f"Added `{term}` to `{
|
323
|
-
# display_name}`" # logger.trace(msg)
|
324
424
|
|
325
425
|
|
326
426
|
@logger.catch
|
@@ -683,7 +783,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
683
783
|
try:
|
684
784
|
if object_action == "Update":
|
685
785
|
body = {
|
686
|
-
"class": "
|
786
|
+
"class": "UpdateElementRequestBody", "externalSourceGUID": external_source_guid,
|
687
787
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
688
788
|
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing, "properties": {
|
689
789
|
"class": "DataStructureProperties", "qualifiedName": qualified_name,
|
@@ -714,7 +814,7 @@ def process_data_structure_upsert_command(egeria_client: EgeriaTech, txt: str, d
|
|
714
814
|
else:
|
715
815
|
|
716
816
|
body = {
|
717
|
-
"class": "
|
817
|
+
"class": "NewElementRequestBody", "externalSourceGUID": external_source_guid,
|
718
818
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
719
819
|
"forLineage": False, "forDuplicateProcessing": False, "anchorGUID": anchor_guid,
|
720
820
|
"isOwnAnchor": is_own_anchor, "parentGUID": parent_guid,
|
@@ -847,7 +947,11 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
847
947
|
in_data_structure_names = attributes.get('In Data Structure Names', {}).get('name_list', None)
|
848
948
|
|
849
949
|
data_class = attributes.get('Data Class', {}).get('value', None)
|
850
|
-
|
950
|
+
data_class_guid = attributes.get('Data Class', {}).get('guid', None)
|
951
|
+
|
952
|
+
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
953
|
+
if glossary_term_guid:
|
954
|
+
glossary_term_guid = [glossary_term_guid]
|
851
955
|
|
852
956
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
853
957
|
|
@@ -891,7 +995,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
891
995
|
|
892
996
|
# first update the base data field
|
893
997
|
body = {
|
894
|
-
"class": "
|
998
|
+
"class": "UpdateElementRequestBody", "externalSourceGUID": external_source_guid,
|
895
999
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
896
1000
|
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing, "properties": {
|
897
1001
|
"class": "DataFieldProperties", "qualifiedName": qualified_name, "displayName": display_name,
|
@@ -924,11 +1028,12 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
924
1028
|
|
925
1029
|
# Sync data field related elements (data structure, parent data fields, terms, data classes
|
926
1030
|
sync_data_field_rel_elements(egeria_client, data_structure_guid_list, parent_data_field_guids,
|
927
|
-
|
1031
|
+
glossary_term_guid, data_class_guid, guid, display_name, replace_all_props)
|
928
1032
|
core_props += f"\n\n## In Data Structure {in_data_structure_names}\n\n"
|
929
1033
|
core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
|
930
1034
|
core_props += f"\n\n## Parent Data Field\n\n{parent_data_field_names}\n\n"
|
931
|
-
core_props += "\
|
1035
|
+
core_props += f"\n\n## Data Class\n\n{data_class}\n\n"
|
1036
|
+
core_props += "\n_______________________________________________________________________________\n\n"
|
932
1037
|
|
933
1038
|
# Update data classes
|
934
1039
|
logger.success(f"Updated Element `{display_name}`\n\n___")
|
@@ -943,6 +1048,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
943
1048
|
else:
|
944
1049
|
# First lets create the data field
|
945
1050
|
body = {
|
1051
|
+
"class": "NewElementRequestBody",
|
946
1052
|
"properties": {
|
947
1053
|
"class": "DataFieldProperties", "qualifiedName": qualified_name,
|
948
1054
|
"displayName": display_name, "namespace": namespace, "description": description,
|
@@ -974,7 +1080,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
974
1080
|
for ds_guid in data_structure_guid_list:
|
975
1081
|
# todo This is too naive? - need to better accommodate the relationship
|
976
1082
|
df_body = {
|
977
|
-
"class": "
|
1083
|
+
"class": "RelationshipRequestBody", "properties": {
|
978
1084
|
"class": "MemberDataFieldProperties", "dataFieldPosition": position,
|
979
1085
|
"minCardinality": min_cardinality, "maxCardinality": max_cardinality,
|
980
1086
|
}
|
@@ -988,7 +1094,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
988
1094
|
if glossary_term:
|
989
1095
|
if glossary_term_guid:
|
990
1096
|
glossary_body = {
|
991
|
-
"class": "
|
1097
|
+
"class": "RelationshipRequestBody", "externalSourceGUID": external_source_guid,
|
992
1098
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
993
1099
|
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing
|
994
1100
|
}
|
@@ -1008,13 +1114,22 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1008
1114
|
core_props += f"\n\n## Parent Data Field\n\n{parent_data_field_names}\n\n"
|
1009
1115
|
|
1010
1116
|
# Link data class
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1117
|
+
if data_class:
|
1118
|
+
body = {
|
1119
|
+
"class": "RelationshipRequestBody",
|
1120
|
+
"externalSourceGUID": external_source_guid,
|
1121
|
+
"externalSourceName": external_source_name,
|
1122
|
+
"effectiveTime": effective_time,
|
1123
|
+
"forLineage": for_lineage,
|
1124
|
+
"forDuplicateProcessing": for_duplicate_processing
|
1125
|
+
}
|
1126
|
+
egeria_client.link_data_class_definition(guid, data_class_guid, body)
|
1127
|
+
msg = f"Adding data class `{data_class}` to data field {display_name}"
|
1128
|
+
logger.info(msg)
|
1015
1129
|
|
1016
1130
|
logger.success(f"Created Element `{display_name}` with guid `{guid}`")
|
1017
|
-
|
1131
|
+
logger.success("=====================================================\n\n")
|
1132
|
+
core_props += "\n___\n\n"
|
1018
1133
|
return core_props
|
1019
1134
|
|
1020
1135
|
else:
|
@@ -1070,8 +1185,8 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1070
1185
|
external_source_guid = attributes.get('External Source Name', {}).get('guid', None)
|
1071
1186
|
external_source_name = attributes.get('External Source Name', {}).get('value', None)
|
1072
1187
|
effective_time = attributes.get('Effective Time', {}).get('value', None)
|
1073
|
-
for_lineage = attributes.get('For Lineage', {}).get('value',
|
1074
|
-
for_duplicate_processing = attributes.get('For Duplicate Processing', {}).get('value',
|
1188
|
+
for_lineage = attributes.get('For Lineage', {}).get('value', False)
|
1189
|
+
for_duplicate_processing = attributes.get('For Duplicate Processing', {}).get('value', False)
|
1075
1190
|
anchor_guid = attributes.get('Anchor ID', {}).get('guid', None)
|
1076
1191
|
is_own_anchor = attributes.get('Is Own Anchor', {}).get('value', None)
|
1077
1192
|
# parent_id = attributes.get('Parent ID', {}).get('value', None)
|
@@ -1116,7 +1231,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1116
1231
|
glossary_term = attributes.get('Glossary Term', {}).get('value', None)
|
1117
1232
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
1118
1233
|
|
1119
|
-
merge_update = attributes.get('Merge Update', {}).get('value',
|
1234
|
+
merge_update = attributes.get('Merge Update', {}).get('value', True)
|
1120
1235
|
|
1121
1236
|
position = attributes.get('Position', {}).get('value', None)
|
1122
1237
|
min_cardinality = attributes.get('Minimum Cardinality', {}).get('value', None)
|
@@ -1131,6 +1246,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1131
1246
|
|
1132
1247
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
1133
1248
|
|
1249
|
+
|
1134
1250
|
in_data_dictionary = attributes.get('In Data Dictionary', {}).get('value', None)
|
1135
1251
|
in_data_dictionary_names = attributes.get('In Data Dictionary', {}).get('name_list', None)
|
1136
1252
|
data_dict_guid_list = attributes.get("In Data Dictionary", {}).get("guid_list", None)
|
@@ -1168,7 +1284,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1168
1284
|
|
1169
1285
|
# first update the base data class
|
1170
1286
|
body = {
|
1171
|
-
"class": "
|
1287
|
+
"class": "UpdateElementRequestBody", "externalSourceGUID": external_source_guid,
|
1172
1288
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
1173
1289
|
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing, "properties": {
|
1174
1290
|
"class": "DataClassProperties", "qualifiedName": qualified_name, "displayName": display_name,
|
@@ -1198,8 +1314,8 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1198
1314
|
core_props += f"\n\n## In Data Dictionary\n\n{in_data_dictionary_names}\n\n"
|
1199
1315
|
|
1200
1316
|
# Sync data field related elements (data structure, parent data fields, terms, data classes
|
1201
|
-
sync_data_class_rel_elements(egeria_client, containing_data_class_guids,
|
1202
|
-
specializes_data_class_guid,
|
1317
|
+
sync_data_class_rel_elements(egeria_client, containing_data_class_guids, glossary_term_guid,
|
1318
|
+
specializes_data_class_guid, guid, display_name,
|
1203
1319
|
replace_all_props)
|
1204
1320
|
|
1205
1321
|
core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
|
@@ -1219,6 +1335,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1219
1335
|
else:
|
1220
1336
|
# First lets create the data class
|
1221
1337
|
body = {
|
1338
|
+
"class": "NewElementRequestBody",
|
1222
1339
|
"properties": {
|
1223
1340
|
"class": "DataClassProperties", "qualifiedName": qualified_name,
|
1224
1341
|
"displayName": display_name, "description": description, "namespace": namespace,
|
@@ -1249,7 +1366,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1249
1366
|
if glossary_term:
|
1250
1367
|
if glossary_term_guid:
|
1251
1368
|
glossary_body = {
|
1252
|
-
"class": "
|
1369
|
+
"class": "RelationshipRequestBody", "externalSourceGUID": external_source_guid,
|
1253
1370
|
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
1254
1371
|
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing
|
1255
1372
|
}
|
@@ -1282,7 +1399,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1282
1399
|
|
1283
1400
|
|
1284
1401
|
@logger.catch
|
1285
|
-
def
|
1402
|
+
def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1286
1403
|
"""
|
1287
1404
|
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1288
1405
|
search string from the given text.
|
@@ -1293,6 +1410,12 @@ def process_data_dict_list_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
1293
1410
|
:return: A string summarizing the outcome of the processing.
|
1294
1411
|
"""
|
1295
1412
|
command, object_type, object_action = extract_command_plus(txt)
|
1413
|
+
if object_type in ["Data Dictionary", "Data Dictionaries", "DataDict", "DataDictionary"]:
|
1414
|
+
col_type = "DataDictionary"
|
1415
|
+
elif object_type in ["Data Specification", "Data Specifications", "Data Specs"]:
|
1416
|
+
col_type = "DataSpec"
|
1417
|
+
else:
|
1418
|
+
col_type = "Collection"
|
1296
1419
|
|
1297
1420
|
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1298
1421
|
|
@@ -1324,13 +1447,197 @@ def process_data_dict_list_command(egeria_client: EgeriaTech, txt: str, directiv
|
|
1324
1447
|
logger.error(msg)
|
1325
1448
|
return None
|
1326
1449
|
|
1327
|
-
list_md = f"\n#
|
1450
|
+
list_md = f"\n# `{col_type}` with filter: `{search_string}`\n\n"
|
1451
|
+
if search_string == "*":
|
1452
|
+
struct = egeria_client.get_classified_collections(col_type, output_format=output_format)
|
1453
|
+
else:
|
1454
|
+
struct = egeria_client.find_collections(search_string, output_format=output_format)
|
1455
|
+
|
1456
|
+
if output_format == "DICT":
|
1457
|
+
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1458
|
+
else:
|
1459
|
+
list_md += struct
|
1460
|
+
logger.info(f"Wrote `{col_type}` for search string: `{search_string}`")
|
1461
|
+
|
1462
|
+
return list_md
|
1463
|
+
|
1464
|
+
except Exception as e:
|
1465
|
+
logger.error(f"Error performing {command}: {e}")
|
1466
|
+
console.print_exception(show_locals=True)
|
1467
|
+
return None
|
1468
|
+
else:
|
1469
|
+
return None
|
1470
|
+
|
1471
|
+
def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1472
|
+
"""
|
1473
|
+
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1474
|
+
search string from the given text.
|
1475
|
+
|
1476
|
+
:param txt: A string representing the input cell to be processed for
|
1477
|
+
extracting term-related attributes.
|
1478
|
+
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1479
|
+
:return: A string summarizing the outcome of the processing.
|
1480
|
+
"""
|
1481
|
+
command, object_type, object_action = extract_command_plus(txt)
|
1482
|
+
|
1483
|
+
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1484
|
+
|
1485
|
+
attributes = parsed_output['attributes']
|
1486
|
+
|
1487
|
+
valid = parsed_output['valid']
|
1488
|
+
|
1489
|
+
print(Markdown(parsed_output['display']))
|
1490
|
+
|
1491
|
+
if directive == "display":
|
1492
|
+
return None
|
1493
|
+
elif directive == "validate":
|
1494
|
+
if valid:
|
1495
|
+
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1496
|
+
else:
|
1497
|
+
msg = f"Validation failed for object_action `{command}`\n"
|
1498
|
+
logger.error(msg)
|
1499
|
+
return valid
|
1500
|
+
|
1501
|
+
elif directive == "process":
|
1502
|
+
attributes = parsed_output['attributes']
|
1503
|
+
search_string = attributes.get('Search String', {}).get('value', '*')
|
1504
|
+
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1505
|
+
detailed = attributes.get('Detailed', {}).get('value', False)
|
1506
|
+
|
1507
|
+
try:
|
1508
|
+
if not valid: # First validate the command before we process it
|
1509
|
+
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1510
|
+
logger.error(msg)
|
1511
|
+
return None
|
1512
|
+
|
1513
|
+
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1514
|
+
struct = egeria_client.find_data_structures(search_string, output_format=output_format)
|
1515
|
+
|
1516
|
+
if output_format == "DICT":
|
1517
|
+
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1518
|
+
else:
|
1519
|
+
list_md += struct
|
1520
|
+
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1521
|
+
|
1522
|
+
return list_md
|
1523
|
+
|
1524
|
+
except Exception as e:
|
1525
|
+
logger.error(f"Error performing {command}: {e}")
|
1526
|
+
console.print_exception(show_locals=True)
|
1527
|
+
return None
|
1528
|
+
else:
|
1529
|
+
return None
|
1530
|
+
|
1531
|
+
def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1532
|
+
"""
|
1533
|
+
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1534
|
+
search string from the given text.
|
1535
|
+
|
1536
|
+
:param txt: A string representing the input cell to be processed for
|
1537
|
+
extracting term-related attributes.
|
1538
|
+
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1539
|
+
:return: A string summarizing the outcome of the processing.
|
1540
|
+
"""
|
1541
|
+
command, object_type, object_action = extract_command_plus(txt)
|
1542
|
+
|
1543
|
+
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1544
|
+
|
1545
|
+
attributes = parsed_output['attributes']
|
1546
|
+
|
1547
|
+
valid = parsed_output['valid']
|
1548
|
+
|
1549
|
+
print(Markdown(parsed_output['display']))
|
1550
|
+
|
1551
|
+
if directive == "display":
|
1552
|
+
return None
|
1553
|
+
elif directive == "validate":
|
1554
|
+
if valid:
|
1555
|
+
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1556
|
+
else:
|
1557
|
+
msg = f"Validation failed for object_action `{command}`\n"
|
1558
|
+
logger.error(msg)
|
1559
|
+
return valid
|
1560
|
+
|
1561
|
+
elif directive == "process":
|
1562
|
+
attributes = parsed_output['attributes']
|
1563
|
+
search_string = attributes.get('Search String', {}).get('value', '*')
|
1564
|
+
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1565
|
+
detailed = attributes.get('Detailed', {}).get('value', False)
|
1566
|
+
|
1567
|
+
try:
|
1568
|
+
if not valid: # First validate the command before we process it
|
1569
|
+
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1570
|
+
logger.error(msg)
|
1571
|
+
return None
|
1572
|
+
|
1573
|
+
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1574
|
+
struct = egeria_client.find_data_fields(search_string, output_format=output_format)
|
1575
|
+
|
1576
|
+
if output_format == "DICT":
|
1577
|
+
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1578
|
+
else:
|
1579
|
+
list_md += struct
|
1580
|
+
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1581
|
+
|
1582
|
+
return list_md
|
1583
|
+
|
1584
|
+
except Exception as e:
|
1585
|
+
logger.error(f"Error performing {command}: {e}")
|
1586
|
+
console.print_exception(show_locals=True)
|
1587
|
+
return None
|
1588
|
+
else:
|
1589
|
+
return None
|
1590
|
+
|
1591
|
+
def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1592
|
+
"""
|
1593
|
+
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1594
|
+
search string from the given text.
|
1595
|
+
|
1596
|
+
:param txt: A string representing the input cell to be processed for
|
1597
|
+
extracting term-related attributes.
|
1598
|
+
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
1599
|
+
:return: A string summarizing the outcome of the processing.
|
1600
|
+
"""
|
1601
|
+
command, object_type, object_action = extract_command_plus(txt)
|
1602
|
+
|
1603
|
+
parsed_output = parse_view_command(egeria_client, object_type, object_action, txt, directive)
|
1604
|
+
|
1605
|
+
attributes = parsed_output['attributes']
|
1606
|
+
|
1607
|
+
valid = parsed_output['valid']
|
1608
|
+
|
1609
|
+
print(Markdown(parsed_output['display']))
|
1610
|
+
|
1611
|
+
if directive == "display":
|
1612
|
+
return None
|
1613
|
+
elif directive == "validate":
|
1614
|
+
if valid:
|
1615
|
+
print(Markdown(f"==> Validation of {command} completed successfully!\n"))
|
1616
|
+
else:
|
1617
|
+
msg = f"Validation failed for object_action `{command}`\n"
|
1618
|
+
logger.error(msg)
|
1619
|
+
return valid
|
1620
|
+
|
1621
|
+
elif directive == "process":
|
1622
|
+
attributes = parsed_output['attributes']
|
1623
|
+
search_string = attributes.get('Search String', {}).get('value', '*')
|
1624
|
+
output_format = attributes.get('Output Format', {}).get('value', 'LIST')
|
1625
|
+
detailed = attributes.get('Detailed', {}).get('value', False)
|
1626
|
+
|
1627
|
+
try:
|
1628
|
+
if not valid: # First validate the command before we process it
|
1629
|
+
msg = f"Validation failed for {object_action} `{object_type}`\n"
|
1630
|
+
logger.error(msg)
|
1631
|
+
return None
|
1632
|
+
|
1633
|
+
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1634
|
+
struct = egeria_client.find_data_classes(search_string, output_format=output_format)
|
1635
|
+
|
1328
1636
|
if output_format == "DICT":
|
1329
|
-
|
1330
|
-
list_md += f"```{json.dumps(struct, indent=4)}```\n"
|
1637
|
+
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
1331
1638
|
else:
|
1332
|
-
list_md +=
|
1333
|
-
logger.info(f"Wrote
|
1639
|
+
list_md += struct
|
1640
|
+
logger.info(f"Wrote `{object_type}` for search string: `{search_string}`")
|
1334
1641
|
|
1335
1642
|
return list_md
|
1336
1643
|
|