pyegeria 5.4.0.dev9__py3-none-any.whl → 5.4.0.dev11__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/debug_log +19333 -3053
- commands/cat/dr_egeria_md.py +1 -1
- commands/cat/list_collections.py +3 -3
- md_processing/md_commands/data_designer_commands.py +46 -64
- md_processing/md_commands/glossary_commands.py +1 -0
- md_processing/md_processing_utils/common_md_proc_utils.py +1 -1
- pyegeria/collection_manager_omvs.py +4525 -1183
- {pyegeria-5.4.0.dev9.dist-info → pyegeria-5.4.0.dev11.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.dev9.dist-info → pyegeria-5.4.0.dev11.dist-info}/RECORD +12 -12
- {pyegeria-5.4.0.dev9.dist-info → pyegeria-5.4.0.dev11.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.dev9.dist-info → pyegeria-5.4.0.dev11.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.dev9.dist-info → pyegeria-5.4.0.dev11.dist-info}/entry_points.txt +0 -0
commands/cat/dr_egeria_md.py
CHANGED
@@ -6,7 +6,7 @@ from datetime import datetime
|
|
6
6
|
from loguru import logger
|
7
7
|
log_format = "{time} | {level} | {function} | {line} | {message} | {extra}"
|
8
8
|
logger.remove()
|
9
|
-
logger.add(sys.stderr, level="
|
9
|
+
logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
|
10
10
|
logger.add("debug_log.log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
11
11
|
colorize=True)
|
12
12
|
import click
|
commands/cat/list_collections.py
CHANGED
@@ -90,11 +90,11 @@ def display_collections(
|
|
90
90
|
|
91
91
|
if output_format != "TABLE":
|
92
92
|
file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_OUTBOX_PATH)
|
93
|
-
file_name = f"
|
93
|
+
file_name = f"Collections-{time.strftime('%Y-%m-%d-%H-%M-%S')}-{action}.md"
|
94
94
|
full_file_path = os.path.join(file_path, file_name)
|
95
95
|
os.makedirs(os.path.dirname(full_file_path), exist_ok=True)
|
96
96
|
output = m_client.find_collections(
|
97
|
-
search_string.strip(), None,
|
97
|
+
search_string.strip(), None, True, False, ignore_case=True,
|
98
98
|
output_format=output_format
|
99
99
|
)
|
100
100
|
if output == NO_ELEMENTS_FOUND:
|
@@ -129,7 +129,7 @@ def display_collections(
|
|
129
129
|
table.add_column("Members")
|
130
130
|
|
131
131
|
collections = m_client.find_collections(
|
132
|
-
search_string.strip(), None,
|
132
|
+
search_string.strip(), None, True, False, ignore_case=True,
|
133
133
|
output_format = "DICT"
|
134
134
|
)
|
135
135
|
if type(collections) is list:
|
@@ -2,7 +2,8 @@
|
|
2
2
|
This file contains term-related object_action functions for processing Egeria Markdown
|
3
3
|
"""
|
4
4
|
import json
|
5
|
-
import
|
5
|
+
import os
|
6
|
+
import sys
|
6
7
|
from typing import Optional
|
7
8
|
|
8
9
|
from loguru import logger
|
@@ -16,8 +17,6 @@ from md_processing.md_processing_utils.extraction_utils import (extract_command_
|
|
16
17
|
from md_processing.md_processing_utils.md_processing_constants import (load_commands, ERROR)
|
17
18
|
from pyegeria import DEBUG_LEVEL, body_slimmer
|
18
19
|
from pyegeria.egeria_tech_client import EgeriaTech
|
19
|
-
from pyegeria.output_formatter import (extract_mermaid_only, extract_basic_dict, generate_output)
|
20
|
-
|
21
20
|
|
22
21
|
GERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
23
22
|
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
@@ -45,7 +44,7 @@ console = Console(width=int(200))
|
|
45
44
|
|
46
45
|
log_format = "D {time} | {level} | {function} | {line} | {message} | {extra}"
|
47
46
|
logger.remove()
|
48
|
-
logger.add(sys.stderr, level="
|
47
|
+
logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
|
49
48
|
full_file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_INBOX_PATH, "data_designer_debug.log")
|
50
49
|
# logger.add(full_file_path, rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
51
50
|
# colorize=True)
|
@@ -63,8 +62,10 @@ def add_member_to_data_collections(egeria_client: EgeriaTech, collection_list: l
|
|
63
62
|
Add member to data dictionaries and data specifications.
|
64
63
|
"""
|
65
64
|
body = {
|
66
|
-
"class": "
|
67
|
-
|
65
|
+
"class": "RelationshipRequestBody", "properties": {
|
66
|
+
"class": "CollectionMembershipProperties", "membershipRationale": "User Specified",
|
67
|
+
"notes": "Added by Dr.Egeria"
|
68
|
+
}
|
68
69
|
}
|
69
70
|
try:
|
70
71
|
if collection_list is not None:
|
@@ -200,7 +201,6 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
200
201
|
logger.warning("Unexpected -> the list was None - assigning empty list")
|
201
202
|
rel_el_list = {}
|
202
203
|
|
203
|
-
|
204
204
|
as_is_data_structs = set(rel_el_list.get("data_structure_guids", []))
|
205
205
|
as_is_parent_fields = set(rel_el_list.get("parent_guids", []))
|
206
206
|
as_is_assigned_meanings = set(rel_el_list.get("assigned_meanings_guids", []))
|
@@ -269,10 +269,8 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
269
269
|
if len(terms_to_remove) > 0:
|
270
270
|
for dc in classes_to_remove:
|
271
271
|
body = {
|
272
|
-
"class": "MetadataSourceRequestBody",
|
273
|
-
|
274
|
-
"forDuplicateProcessing": False
|
275
|
-
}
|
272
|
+
"class": "MetadataSourceRequestBody", "forLineage": False, "forDuplicateProcessing": False
|
273
|
+
}
|
276
274
|
egeria_client.detach_data_class_definition(guid, dc, body)
|
277
275
|
msg = f"Removed `{dc}` from `{display_name}`"
|
278
276
|
logger.trace(msg)
|
@@ -281,9 +279,7 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
|
|
281
279
|
if len(terms_to_add) > 0:
|
282
280
|
for dc in classes_to_add:
|
283
281
|
body = {
|
284
|
-
"class": "RelationshipRequestBody",
|
285
|
-
"forLineage": False,
|
286
|
-
"forDuplicateProcessing": False
|
282
|
+
"class": "RelationshipRequestBody", "forLineage": False, "forDuplicateProcessing": False
|
287
283
|
}
|
288
284
|
egeria_client.link_data_class_definition(guid, dc, body)
|
289
285
|
msg = f"Added `{dc}` to`{display_name}`"
|
@@ -346,7 +342,6 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
346
342
|
logger.trace(f"as_is_specialized_classes: {list(as_is_specialized_classes)} to_be_specizialized_data_classes: "
|
347
343
|
f"{list(to_be_specialized_classes)}")
|
348
344
|
|
349
|
-
|
350
345
|
nested_classes_to_remove = to_be_nested_classes - as_is_nested_classes
|
351
346
|
logger.trace(f"nested_classes_to_remove: {list(nested_classes_to_remove)}")
|
352
347
|
if len(nested_classes_to_remove) > 0:
|
@@ -382,9 +377,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
382
377
|
if len(terms_to_remove) > 0:
|
383
378
|
for dc in specialized_classes_to_remove:
|
384
379
|
body = {
|
385
|
-
"class": "MetadataSourceRequestBody",
|
386
|
-
"forLineage": False,
|
387
|
-
"forDuplicateProcessing": False
|
380
|
+
"class": "MetadataSourceRequestBody", "forLineage": False, "forDuplicateProcessing": False
|
388
381
|
}
|
389
382
|
egeria_client.detach_specialist_data_class(guid, dc, body)
|
390
383
|
msg = f"Removed `{dc}` from `{display_name}`"
|
@@ -394,9 +387,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
394
387
|
if len(specialized_classes_to_add) > 0:
|
395
388
|
for dc in specialized_classes_to_add:
|
396
389
|
body = {
|
397
|
-
"class": "RelationshipRequestBody",
|
398
|
-
"forLineage": False,
|
399
|
-
"forDuplicateProcessing": False
|
390
|
+
"class": "RelationshipRequestBody", "forLineage": False, "forDuplicateProcessing": False
|
400
391
|
}
|
401
392
|
egeria_client.link_specialist_data_class(guid, dc, body)
|
402
393
|
msg = f"Added `{dc}` to`{display_name}`"
|
@@ -422,8 +413,6 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
|
|
422
413
|
logger.trace(msg)
|
423
414
|
|
424
415
|
|
425
|
-
|
426
|
-
|
427
416
|
@logger.catch
|
428
417
|
def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
429
418
|
"""
|
@@ -504,8 +493,8 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
504
493
|
f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
|
505
494
|
|
506
495
|
egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
|
507
|
-
collection_ordering, order_property_name,
|
508
|
-
|
496
|
+
collection_ordering, order_property_name, additional_properties,
|
497
|
+
extended_properties, replace_all_props)
|
509
498
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
510
499
|
update_element_dictionary(qualified_name, {
|
511
500
|
'guid': guid, 'display_name': display_name
|
@@ -526,10 +515,12 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
526
515
|
logger.error(msg)
|
527
516
|
return None
|
528
517
|
else:
|
529
|
-
guid = egeria_client.create_data_spec_collection(
|
518
|
+
guid = egeria_client.create_data_spec_collection(display_name, description, qualified_name,
|
519
|
+
is_own_anchor, anchor_guid, parent_guid,
|
530
520
|
parent_relationship_type_name, parent_at_end1,
|
531
|
-
|
532
|
-
|
521
|
+
collection_type, anchor_scope_guid,
|
522
|
+
collection_ordering, order_property_name,
|
523
|
+
additional_properties, extended_properties)
|
533
524
|
if guid:
|
534
525
|
update_element_dictionary(qualified_name, {
|
535
526
|
'guid': guid, 'display_name': display_name
|
@@ -625,8 +616,8 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
625
616
|
f"==> Validation of {command} completed successfully! Proceeding to apply the changes."))
|
626
617
|
|
627
618
|
egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
|
628
|
-
collection_ordering, order_property_name,
|
629
|
-
|
619
|
+
collection_ordering, order_property_name, additional_properties,
|
620
|
+
extended_properties, replace_all_props)
|
630
621
|
logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
|
631
622
|
update_element_dictionary(qualified_name, {
|
632
623
|
'guid': guid, 'display_name': display_name
|
@@ -639,12 +630,13 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
|
|
639
630
|
f"`Create` to `Update` in processed output\n\n___")
|
640
631
|
return update_a_command(txt, object_action, object_type, qualified_name, guid)
|
641
632
|
else:
|
642
|
-
guid = egeria_client.create_data_dictionary_collection(
|
633
|
+
guid = egeria_client.create_data_dictionary_collection(display_name, description, qualified_name,
|
634
|
+
is_own_anchor, anchor_guid, parent_guid,
|
643
635
|
parent_relationship_type_name,
|
644
|
-
parent_at_end1,
|
645
|
-
|
646
|
-
|
647
|
-
|
636
|
+
parent_at_end1, collection_type,
|
637
|
+
anchor_scope_guid, collection_ordering,
|
638
|
+
order_property_name, additional_properties,
|
639
|
+
extended_properties)
|
648
640
|
if guid:
|
649
641
|
update_element_dictionary(qualified_name, {
|
650
642
|
'guid': guid, 'display_name': display_name
|
@@ -1049,8 +1041,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1049
1041
|
else:
|
1050
1042
|
# First lets create the data field
|
1051
1043
|
body = {
|
1052
|
-
"class": "NewElementRequestBody",
|
1053
|
-
"properties": {
|
1044
|
+
"class": "NewElementRequestBody", "properties": {
|
1054
1045
|
"class": "DataFieldProperties", "qualifiedName": qualified_name,
|
1055
1046
|
"displayName": display_name, "namespace": namespace, "description": description,
|
1056
1047
|
"versionIdentifier": version_id, "aliases": aliases, "namePatterns": name_patterns,
|
@@ -1117,13 +1108,10 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1117
1108
|
# Link data class
|
1118
1109
|
if data_class:
|
1119
1110
|
body = {
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
"forLineage": for_lineage,
|
1125
|
-
"forDuplicateProcessing": for_duplicate_processing
|
1126
|
-
}
|
1111
|
+
"class": "RelationshipRequestBody", "externalSourceGUID": external_source_guid,
|
1112
|
+
"externalSourceName": external_source_name, "effectiveTime": effective_time,
|
1113
|
+
"forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing
|
1114
|
+
}
|
1127
1115
|
egeria_client.link_data_class_definition(guid, data_class_guid, body)
|
1128
1116
|
msg = f"Adding data class `{data_class}` to data field {display_name}"
|
1129
1117
|
logger.info(msg)
|
@@ -1247,7 +1235,6 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1247
1235
|
|
1248
1236
|
glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
|
1249
1237
|
|
1250
|
-
|
1251
1238
|
in_data_dictionary = attributes.get('In Data Dictionary', {}).get('value', None)
|
1252
1239
|
in_data_dictionary_names = attributes.get('In Data Dictionary', {}).get('name_list', None)
|
1253
1240
|
data_dict_guid_list = attributes.get("In Data Dictionary", {}).get("guid_list", None)
|
@@ -1316,8 +1303,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1316
1303
|
|
1317
1304
|
# Sync data field related elements (data structure, parent data fields, terms, data classes
|
1318
1305
|
sync_data_class_rel_elements(egeria_client, containing_data_class_guids, glossary_term_guid,
|
1319
|
-
specializes_data_class_guid, guid, display_name,
|
1320
|
-
replace_all_props)
|
1306
|
+
specializes_data_class_guid, guid, display_name, replace_all_props)
|
1321
1307
|
|
1322
1308
|
core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
|
1323
1309
|
core_props += f"\n\n## Containing Data Class\n\n{containing_data_class_names}\n\n"
|
@@ -1336,8 +1322,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1336
1322
|
else:
|
1337
1323
|
# First lets create the data class
|
1338
1324
|
body = {
|
1339
|
-
"class": "NewElementRequestBody",
|
1340
|
-
"properties": {
|
1325
|
+
"class": "NewElementRequestBody", "properties": {
|
1341
1326
|
"class": "DataClassProperties", "qualifiedName": qualified_name,
|
1342
1327
|
"displayName": display_name, "description": description, "namespace": namespace,
|
1343
1328
|
"matchPropertyNames": match_property_names, "matchThreshold": match_threshold,
|
@@ -1400,7 +1385,8 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
|
|
1400
1385
|
|
1401
1386
|
|
1402
1387
|
@logger.catch
|
1403
|
-
def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1388
|
+
def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1389
|
+
str]:
|
1404
1390
|
"""
|
1405
1391
|
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1406
1392
|
search string from the given text.
|
@@ -1469,7 +1455,9 @@ def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, di
|
|
1469
1455
|
else:
|
1470
1456
|
return None
|
1471
1457
|
|
1472
|
-
|
1458
|
+
|
1459
|
+
def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
|
1460
|
+
str]:
|
1473
1461
|
"""
|
1474
1462
|
Processes a Data Dictionary list object_action by extracting key attributes such as
|
1475
1463
|
search string from the given text.
|
@@ -1529,6 +1517,7 @@ def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, dir
|
|
1529
1517
|
else:
|
1530
1518
|
return None
|
1531
1519
|
|
1520
|
+
|
1532
1521
|
def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1533
1522
|
"""
|
1534
1523
|
Processes a Data Dictionary list object_action by extracting key attributes such as
|
@@ -1582,18 +1571,12 @@ def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directi
|
|
1582
1571
|
|
1583
1572
|
list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
|
1584
1573
|
body = {
|
1585
|
-
"class": "FilterRequestBody",
|
1586
|
-
"
|
1587
|
-
"
|
1588
|
-
"forLineage": False,
|
1589
|
-
"forDuplicateProcessing" : False,
|
1590
|
-
"limitResultsByStatus": ["ACTIVE"],
|
1591
|
-
"sequencingOrder": sort_order,
|
1592
|
-
"sequencingProperty": order_property,
|
1593
|
-
"filter": search_string,
|
1574
|
+
"class": "FilterRequestBody", "asOfTime": as_of_time, "effectiveTime": effective_time,
|
1575
|
+
"forLineage": False, "forDuplicateProcessing": False, "limitResultsByStatus": ["ACTIVE"],
|
1576
|
+
"sequencingOrder": sort_order, "sequencingProperty": order_property, "filter": search_string,
|
1594
1577
|
}
|
1595
|
-
struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with,
|
1596
|
-
|
1578
|
+
struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with, ends_with,
|
1579
|
+
ignore_case, output_format)
|
1597
1580
|
|
1598
1581
|
if output_format == "DICT":
|
1599
1582
|
list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
|
@@ -1610,6 +1593,7 @@ def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directi
|
|
1610
1593
|
else:
|
1611
1594
|
return None
|
1612
1595
|
|
1596
|
+
|
1613
1597
|
def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1614
1598
|
"""
|
1615
1599
|
Processes a Data Dictionary list object_action by extracting key attributes such as
|
@@ -1669,5 +1653,3 @@ def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directi
|
|
1669
1653
|
return None
|
1670
1654
|
else:
|
1671
1655
|
return None
|
1672
|
-
|
1673
|
-
|
@@ -527,6 +527,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
|
|
527
527
|
else:
|
528
528
|
known_glossary_q_name, known_glossary_guid, glossary_valid, glossary_exists = process_element_identifiers(
|
529
529
|
egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt, EXISTS_REQUIRED, None)
|
530
|
+
# Todo - add logic to fail if no valid glossary provided.
|
530
531
|
|
531
532
|
# process categories, if present
|
532
533
|
categories = process_simple_attribute(txt, ['Glossary Categories', 'Glossary Category', 'Category', 'Categories'])
|
@@ -21,7 +21,7 @@ from pyegeria._globals import DEBUG_LEVEL
|
|
21
21
|
|
22
22
|
log_format = "P {time} | {level} | {function} | {line} | {message} | {extra}"
|
23
23
|
logger.remove()
|
24
|
-
logger.add(sys.stderr, level="
|
24
|
+
logger.add(sys.stderr, level="INFO", format=log_format, colorize=True)
|
25
25
|
logger.add("debug_log.log", rotation="1 day", retention="1 week", compression="zip", level="TRACE", format=log_format,
|
26
26
|
colorize=True)
|
27
27
|
# Constants
|