pyegeria 5.4.0.dev10__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.
@@ -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="SUCCESS", format=log_format, colorize=True)
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
@@ -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"Terms-{time.strftime('%Y-%m-%d-%H-%M-%S')}-{action}.md"
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, None, False, ends_with=False, ignore_case=True,
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, None, False, ends_with=False, ignore_case=True,
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 sys, os
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="ERROR", format=log_format, colorize=True)
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,10 +62,8 @@ 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": "RelationshipRequestBody",
67
- "properties": {
68
- "class": "CollectionMembershipProperties",
69
- "membershipRationale": "User Specified",
65
+ "class": "RelationshipRequestBody", "properties": {
66
+ "class": "CollectionMembershipProperties", "membershipRationale": "User Specified",
70
67
  "notes": "Added by Dr.Egeria"
71
68
  }
72
69
  }
@@ -204,7 +201,6 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
204
201
  logger.warning("Unexpected -> the list was None - assigning empty list")
205
202
  rel_el_list = {}
206
203
 
207
-
208
204
  as_is_data_structs = set(rel_el_list.get("data_structure_guids", []))
209
205
  as_is_parent_fields = set(rel_el_list.get("parent_guids", []))
210
206
  as_is_assigned_meanings = set(rel_el_list.get("assigned_meanings_guids", []))
@@ -273,10 +269,8 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
273
269
  if len(terms_to_remove) > 0:
274
270
  for dc in classes_to_remove:
275
271
  body = {
276
- "class": "MetadataSourceRequestBody",
277
- "forLineage": False,
278
- "forDuplicateProcessing": False
279
- }
272
+ "class": "MetadataSourceRequestBody", "forLineage": False, "forDuplicateProcessing": False
273
+ }
280
274
  egeria_client.detach_data_class_definition(guid, dc, body)
281
275
  msg = f"Removed `{dc}` from `{display_name}`"
282
276
  logger.trace(msg)
@@ -285,9 +279,7 @@ def sync_data_field_rel_elements(egeria_client: EgeriaTech, structure_list: list
285
279
  if len(terms_to_add) > 0:
286
280
  for dc in classes_to_add:
287
281
  body = {
288
- "class": "RelationshipRequestBody",
289
- "forLineage": False,
290
- "forDuplicateProcessing": False
282
+ "class": "RelationshipRequestBody", "forLineage": False, "forDuplicateProcessing": False
291
283
  }
292
284
  egeria_client.link_data_class_definition(guid, dc, body)
293
285
  msg = f"Added `{dc}` to`{display_name}`"
@@ -350,7 +342,6 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
350
342
  logger.trace(f"as_is_specialized_classes: {list(as_is_specialized_classes)} to_be_specizialized_data_classes: "
351
343
  f"{list(to_be_specialized_classes)}")
352
344
 
353
-
354
345
  nested_classes_to_remove = to_be_nested_classes - as_is_nested_classes
355
346
  logger.trace(f"nested_classes_to_remove: {list(nested_classes_to_remove)}")
356
347
  if len(nested_classes_to_remove) > 0:
@@ -386,9 +377,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
386
377
  if len(terms_to_remove) > 0:
387
378
  for dc in specialized_classes_to_remove:
388
379
  body = {
389
- "class": "MetadataSourceRequestBody",
390
- "forLineage": False,
391
- "forDuplicateProcessing": False
380
+ "class": "MetadataSourceRequestBody", "forLineage": False, "forDuplicateProcessing": False
392
381
  }
393
382
  egeria_client.detach_specialist_data_class(guid, dc, body)
394
383
  msg = f"Removed `{dc}` from `{display_name}`"
@@ -398,9 +387,7 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
398
387
  if len(specialized_classes_to_add) > 0:
399
388
  for dc in specialized_classes_to_add:
400
389
  body = {
401
- "class": "RelationshipRequestBody",
402
- "forLineage": False,
403
- "forDuplicateProcessing": False
390
+ "class": "RelationshipRequestBody", "forLineage": False, "forDuplicateProcessing": False
404
391
  }
405
392
  egeria_client.link_specialist_data_class(guid, dc, body)
406
393
  msg = f"Added `{dc}` to`{display_name}`"
@@ -426,8 +413,6 @@ def sync_data_class_rel_elements(egeria_client: EgeriaTech, containing_data_clas
426
413
  logger.trace(msg)
427
414
 
428
415
 
429
-
430
-
431
416
  @logger.catch
432
417
  def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
433
418
  """
@@ -508,8 +493,8 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
508
493
  f"==> Validation of {command} completed successfully! Proceeding to apply the changes.\n"))
509
494
 
510
495
  egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
511
- collection_ordering, order_property_name, replace_all_props,
512
- additional_properties, extended_properties)
496
+ collection_ordering, order_property_name, additional_properties,
497
+ extended_properties, replace_all_props)
513
498
  logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
514
499
  update_element_dictionary(qualified_name, {
515
500
  'guid': guid, 'display_name': display_name
@@ -530,10 +515,11 @@ def process_data_spec_upsert_command(egeria_client: EgeriaTech, txt: str, direct
530
515
  logger.error(msg)
531
516
  return None
532
517
  else:
533
- guid = egeria_client.create_data_spec_collection(display_name, description,
534
- is_own_anchor, anchor_guid, parent_guid, parent_relationship_type_name,
535
- parent_at_end1, collection_type,
536
- anchor_scope_guid, collection_ordering,order_property_name,
518
+ guid = egeria_client.create_data_spec_collection(display_name, description, qualified_name,
519
+ is_own_anchor, anchor_guid, parent_guid,
520
+ parent_relationship_type_name, parent_at_end1,
521
+ collection_type, anchor_scope_guid,
522
+ collection_ordering, order_property_name,
537
523
  additional_properties, extended_properties)
538
524
  if guid:
539
525
  update_element_dictionary(qualified_name, {
@@ -630,8 +616,8 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
630
616
  f"==> Validation of {command} completed successfully! Proceeding to apply the changes."))
631
617
 
632
618
  egeria_client.update_collection(guid, qualified_name, display_name, description, collection_type,
633
- collection_ordering, order_property_name, replace_all_props,
634
- additional_properties, extended_properties)
619
+ collection_ordering, order_property_name, additional_properties,
620
+ extended_properties, replace_all_props)
635
621
  logger.success(f"Updated {object_type} `{display_name}` with GUID {guid}\n\n___")
636
622
  update_element_dictionary(qualified_name, {
637
623
  'guid': guid, 'display_name': display_name
@@ -644,8 +630,9 @@ def process_data_dict_upsert_command(egeria_client: EgeriaTech, txt: str, direct
644
630
  f"`Create` to `Update` in processed output\n\n___")
645
631
  return update_a_command(txt, object_action, object_type, qualified_name, guid)
646
632
  else:
647
- guid = egeria_client.create_data_dictionary_collection(display_name,description, is_own_anchor, anchor_guid,
648
- parent_guid, parent_relationship_type_name,
633
+ guid = egeria_client.create_data_dictionary_collection(display_name, description, qualified_name,
634
+ is_own_anchor, anchor_guid, parent_guid,
635
+ parent_relationship_type_name,
649
636
  parent_at_end1, collection_type,
650
637
  anchor_scope_guid, collection_ordering,
651
638
  order_property_name, additional_properties,
@@ -1054,8 +1041,7 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1054
1041
  else:
1055
1042
  # First lets create the data field
1056
1043
  body = {
1057
- "class": "NewElementRequestBody",
1058
- "properties": {
1044
+ "class": "NewElementRequestBody", "properties": {
1059
1045
  "class": "DataFieldProperties", "qualifiedName": qualified_name,
1060
1046
  "displayName": display_name, "namespace": namespace, "description": description,
1061
1047
  "versionIdentifier": version_id, "aliases": aliases, "namePatterns": name_patterns,
@@ -1122,13 +1108,10 @@ def process_data_field_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1122
1108
  # Link data class
1123
1109
  if data_class:
1124
1110
  body = {
1125
- "class": "RelationshipRequestBody",
1126
- "externalSourceGUID": external_source_guid,
1127
- "externalSourceName": external_source_name,
1128
- "effectiveTime": effective_time,
1129
- "forLineage": for_lineage,
1130
- "forDuplicateProcessing": for_duplicate_processing
1131
- }
1111
+ "class": "RelationshipRequestBody", "externalSourceGUID": external_source_guid,
1112
+ "externalSourceName": external_source_name, "effectiveTime": effective_time,
1113
+ "forLineage": for_lineage, "forDuplicateProcessing": for_duplicate_processing
1114
+ }
1132
1115
  egeria_client.link_data_class_definition(guid, data_class_guid, body)
1133
1116
  msg = f"Adding data class `{data_class}` to data field {display_name}"
1134
1117
  logger.info(msg)
@@ -1252,7 +1235,6 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1252
1235
 
1253
1236
  glossary_term_guid = attributes.get('Glossary Term', {}).get('guid', None)
1254
1237
 
1255
-
1256
1238
  in_data_dictionary = attributes.get('In Data Dictionary', {}).get('value', None)
1257
1239
  in_data_dictionary_names = attributes.get('In Data Dictionary', {}).get('name_list', None)
1258
1240
  data_dict_guid_list = attributes.get("In Data Dictionary", {}).get("guid_list", None)
@@ -1321,8 +1303,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1321
1303
 
1322
1304
  # Sync data field related elements (data structure, parent data fields, terms, data classes
1323
1305
  sync_data_class_rel_elements(egeria_client, containing_data_class_guids, glossary_term_guid,
1324
- specializes_data_class_guid, guid, display_name,
1325
- replace_all_props)
1306
+ specializes_data_class_guid, guid, display_name, replace_all_props)
1326
1307
 
1327
1308
  core_props += f"\n\n## Glossary Term \n\n{glossary_term}\n\n"
1328
1309
  core_props += f"\n\n## Containing Data Class\n\n{containing_data_class_names}\n\n"
@@ -1341,8 +1322,7 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1341
1322
  else:
1342
1323
  # First lets create the data class
1343
1324
  body = {
1344
- "class": "NewElementRequestBody",
1345
- "properties": {
1325
+ "class": "NewElementRequestBody", "properties": {
1346
1326
  "class": "DataClassProperties", "qualifiedName": qualified_name,
1347
1327
  "displayName": display_name, "description": description, "namespace": namespace,
1348
1328
  "matchPropertyNames": match_property_names, "matchThreshold": match_threshold,
@@ -1405,7 +1385,8 @@ def process_data_class_upsert_command(egeria_client: EgeriaTech, txt: str, direc
1405
1385
 
1406
1386
 
1407
1387
  @logger.catch
1408
- def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1388
+ def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
1389
+ str]:
1409
1390
  """
1410
1391
  Processes a Data Dictionary list object_action by extracting key attributes such as
1411
1392
  search string from the given text.
@@ -1474,7 +1455,9 @@ def process_data_collection_list_command(egeria_client: EgeriaTech, txt: str, di
1474
1455
  else:
1475
1456
  return None
1476
1457
 
1477
- def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1458
+
1459
+ def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
1460
+ str]:
1478
1461
  """
1479
1462
  Processes a Data Dictionary list object_action by extracting key attributes such as
1480
1463
  search string from the given text.
@@ -1534,6 +1517,7 @@ def process_data_structure_list_command(egeria_client: EgeriaTech, txt: str, dir
1534
1517
  else:
1535
1518
  return None
1536
1519
 
1520
+
1537
1521
  def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1538
1522
  """
1539
1523
  Processes a Data Dictionary list object_action by extracting key attributes such as
@@ -1587,18 +1571,12 @@ def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directi
1587
1571
 
1588
1572
  list_md = f"\n# `{object_type}` with filter: `{search_string}`\n\n"
1589
1573
  body = {
1590
- "class": "FilterRequestBody",
1591
- "asOfTime": as_of_time,
1592
- "effectiveTime": effective_time,
1593
- "forLineage": False,
1594
- "forDuplicateProcessing" : False,
1595
- "limitResultsByStatus": ["ACTIVE"],
1596
- "sequencingOrder": sort_order,
1597
- "sequencingProperty": order_property,
1598
- "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,
1599
1577
  }
1600
- struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with,
1601
- ends_with, ignore_case,output_format)
1578
+ struct = egeria_client.find_data_fields_w_body(body, start_from, page_size, starts_with, ends_with,
1579
+ ignore_case, output_format)
1602
1580
 
1603
1581
  if output_format == "DICT":
1604
1582
  list_md += f"```\n{json.dumps(struct, indent=4)}\n```\n"
@@ -1615,6 +1593,7 @@ def process_data_field_list_command(egeria_client: EgeriaTech, txt: str, directi
1615
1593
  else:
1616
1594
  return None
1617
1595
 
1596
+
1618
1597
  def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1619
1598
  """
1620
1599
  Processes a Data Dictionary list object_action by extracting key attributes such as
@@ -1674,5 +1653,3 @@ def process_data_class_list_command(egeria_client: EgeriaTech, txt: str, directi
1674
1653
  return None
1675
1654
  else:
1676
1655
  return None
1677
-
1678
-
@@ -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="SUCCESS", format=log_format, colorize=True)
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