pyegeria 5.2.0.5__py3-none-any.whl → 5.2.0.7__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.
Files changed (37) hide show
  1. pyegeria/__init__.py +2 -0
  2. pyegeria/_client.py +7 -2
  3. pyegeria/asset_catalog_omvs.py +34 -0
  4. pyegeria/classification_manager_omvs.py +2 -3
  5. pyegeria/collection_manager_omvs.py +83 -39
  6. pyegeria/commands/cat/get_collection.py +22 -13
  7. pyegeria/commands/cat/list_collections.py +10 -5
  8. pyegeria/commands/cat/list_deployed_database_schemas.py +8 -14
  9. pyegeria/commands/cli/egeria.py +31 -38
  10. pyegeria/commands/cli/egeria_cat.py +8 -10
  11. pyegeria/commands/cli/egeria_my.py +1 -5
  12. pyegeria/commands/cli/egeria_ops.py +1 -1
  13. pyegeria/commands/cli/egeria_tech.py +6 -6
  14. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.30.02@2x.png +0 -0
  15. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.31.47@2x.png +0 -0
  16. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.32.11@2x.png +0 -0
  17. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.34.19@2x.png +0 -0
  18. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.42@2x.png +0 -0
  19. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.55@2x.png +0 -0
  20. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.37.07@2x.png +0 -0
  21. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/catalogs 2024-11-25 at 16.28.53@2x.png +0 -0
  22. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
  23. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
  24. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
  25. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
  26. pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
  27. pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
  28. pyegeria/commands/tech/table_tech_templates.py +3 -1
  29. pyegeria/egeria_client.py +2 -0
  30. pyegeria/egeria_tech_client.py +5 -0
  31. pyegeria/metadata_explorer_omvs.py +2086 -0
  32. {pyegeria-5.2.0.5.dist-info → pyegeria-5.2.0.7.dist-info}/METADATA +1 -1
  33. {pyegeria-5.2.0.5.dist-info → pyegeria-5.2.0.7.dist-info}/RECORD +37 -22
  34. /pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/{CleanShot 2024-11-20 at 16.17.43@2x.png → deployed-data-catalogs-2024-11-20 at 16.17.43@2x.png} +0 -0
  35. {pyegeria-5.2.0.5.dist-info → pyegeria-5.2.0.7.dist-info}/LICENSE +0 -0
  36. {pyegeria-5.2.0.5.dist-info → pyegeria-5.2.0.7.dist-info}/WHEEL +0 -0
  37. {pyegeria-5.2.0.5.dist-info → pyegeria-5.2.0.7.dist-info}/entry_points.txt +0 -0
pyegeria/__init__.py CHANGED
@@ -67,6 +67,7 @@ from .glossary_manager_omvs import GlossaryManager
67
67
  from .create_tech_guid_lists import build_global_guid_lists
68
68
  from .classification_manager_omvs import ClassificationManager
69
69
  from .feedback_manager_omvs import FeedbackManager
70
+ from .metadata_explorer_omvs import MetadataExplorer
70
71
  from .mermaid_utilities import load_mermaid, render_mermaid, generate_process_graph
71
72
  from .egeria_my_client import EgeriaMy
72
73
  from .egeria_cat_client import EgeriaCat
@@ -74,6 +75,7 @@ from .egeria_tech_client import EgeriaTech
74
75
  from .egeria_config_client import EgeriaConfig
75
76
  from .egeria_client import Egeria
76
77
 
78
+
77
79
  #
78
80
  # The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
79
81
  # to interrogate Egeria (and the Core Content Pack) for the GUIDS associates with integration connectors and templates.
pyegeria/_client.py CHANGED
@@ -693,6 +693,11 @@ class Client:
693
693
  result = await self._async_make_request("POST", url, body_slimmer(body))
694
694
  return result.json().get("guid", "No elements found")
695
695
 
696
+ try:
697
+ view_server = self.view_server
698
+ except AttributeError:
699
+ view_server = os.environ.get("VIEW_SERVER", "view-server")
700
+
696
701
  if (not qualified_name) and display_name:
697
702
  if (tech_type) and (property_name == "qualifiedName"):
698
703
  name = f"{tech_type}:{display_name}"
@@ -705,7 +710,7 @@ class Client:
705
710
  "effectiveTime": None,
706
711
  }
707
712
  url = (
708
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
713
+ f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
709
714
  f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
710
715
  )
711
716
 
@@ -721,7 +726,7 @@ class Client:
721
726
  "effectiveTime": None,
722
727
  }
723
728
  url = (
724
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
729
+ f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
725
730
  f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
726
731
  )
727
732
 
@@ -506,6 +506,40 @@ class AssetCatalog(Client):
506
506
  )
507
507
  return response
508
508
 
509
+ def get_asset_mermaid_graph(
510
+ self,
511
+ asset_guid: str,
512
+ start_from: int = 0,
513
+ page_size: int = max_paging_size,
514
+ ) -> str:
515
+ """Return the asset graph as mermaid markdown string.
516
+ Parameters
517
+ ----------
518
+ asset_guid : str
519
+ The unique identity of the asset to get the graph for.
520
+
521
+ start_from : int, optional
522
+ The index from which to start fetching the engine actions. Default is 0.
523
+
524
+ page_size : int, optional
525
+ The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
526
+
527
+ Returns
528
+ -------
529
+ str
530
+ A mermaid string representing the asset graph.
531
+
532
+ Raises:
533
+ ------
534
+ InvalidParameterException
535
+ PropertyServerException
536
+ UserNotAuthorizedException
537
+
538
+ """
539
+
540
+ asset_graph = self.get_asset_graph(asset_guid, start_from, page_size)
541
+ return asset_graph.get("mermaidGraph")
542
+
509
543
  async def _async_get_asset_lineage_graph(
510
544
  self,
511
545
  asset_guid: str,
@@ -1,8 +1,7 @@
1
1
  """PDX-License-Identifier: Apache-2.0
2
2
  Copyright Contributors to the ODPi Egeria project.
3
3
 
4
- This module contains an initial version of the classification_manager_omvs
5
- module.
4
+ This module provides access to the classification_manager_omvs module.
6
5
 
7
6
  """
8
7
 
@@ -71,7 +70,7 @@ class ClassificationManager(Client):
71
70
  self.platform_url = platform_url
72
71
  self.user_id = user_id
73
72
  self.user_pwd = user_pwd
74
- self.classification_command_root: str = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/runtime-manager"
73
+ self.classification_command_root: str = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager"
75
74
  Client.__init__(
76
75
  self,
77
76
  view_server,
@@ -2179,7 +2179,9 @@ class CollectionManager(Client):
2179
2179
 
2180
2180
  async def _async_get_collection_members(
2181
2181
  self,
2182
- collection_guid: str,
2182
+ collection_guid: str = None,
2183
+ collection_name: str = None,
2184
+ collection_qname: str = None,
2183
2185
  effective_time: str = None,
2184
2186
  start_from: int = 0,
2185
2187
  page_size: int = None,
@@ -2189,12 +2191,16 @@ class CollectionManager(Client):
2189
2191
  Parameters
2190
2192
  ----------
2191
2193
  collection_guid: str,
2192
- identity of the collection to return members for.
2194
+ identity of the collection to return members for. If none, collection_name or
2195
+ collection_qname are used.
2196
+ collection_name: str,
2197
+ display name of the collection to return members for. If none, collection_guid
2198
+ or collection_qname are used.
2199
+ collection_qname: str,
2200
+ qualified name of the collection to return members for. If none, collection_guid
2201
+ or collection_name are used.
2193
2202
  effective_time: str, [default=None], optional
2194
2203
  Effective time of the query. If not specified will default to any time.
2195
-
2196
-
2197
-
2198
2204
  start_from: int, [default=0], optional
2199
2205
  When multiple pages of results are available, the page number to start from.
2200
2206
  page_size: int, [default=None]
@@ -2220,7 +2226,13 @@ class CollectionManager(Client):
2220
2226
 
2221
2227
  if page_size is None:
2222
2228
  page_size = self.page_size
2223
-
2229
+ collection_guid = self.__get_guid__(
2230
+ collection_guid,
2231
+ collection_name,
2232
+ "name",
2233
+ collection_qname,
2234
+ None,
2235
+ )
2224
2236
  url = (
2225
2237
  f"{self.collection_command_root}/{collection_guid}/"
2226
2238
  f"members?startFrom={start_from}&pageSize={page_size}"
@@ -2231,27 +2243,33 @@ class CollectionManager(Client):
2231
2243
 
2232
2244
  def get_collection_members(
2233
2245
  self,
2234
- collection_guid: str,
2246
+ collection_guid: str = None,
2247
+ collection_name: str = None,
2248
+ collection_qname: str = None,
2235
2249
  effective_time: str = None,
2236
2250
  start_from: int = 0,
2237
2251
  page_size: int = None,
2238
2252
  ) -> list | str:
2239
- """Return a list of elements that are a member of a collection.
2240
-
2241
- Parameters
2242
- ----------
2243
- collection_guid: str,
2244
- identity of the collection to return members for.
2245
- effective_time: str, [default=None], optional
2246
- Effective time of the query. If not specified will default to any time.
2247
-
2248
-
2253
+ """Return a list of elements that are a member of a collection. Async version.
2249
2254
 
2250
- start_from: int, [default=0], optional
2251
- When multiple pages of results are available, the page number to start from.
2252
- page_size: int, [default=None]
2253
- The number of items to return in a single page. If not specified, the default will be taken from
2254
- the class instance.
2255
+ Parameters
2256
+ ----------
2257
+ collection_guid: str,
2258
+ identity of the collection to return members for. If none, collection_name or
2259
+ collection_qname are used.
2260
+ collection_name: str,
2261
+ display name of the collection to return members for. If none, collection_guid
2262
+ or collection_qname are used.
2263
+ collection_qname: str,
2264
+ qualified name of the collection to return members for. If none, collection_guid
2265
+ or collection_name are used.
2266
+ effective_time: str, [default=None], optional
2267
+ Effective time of the query. If not specified will default to any time.
2268
+ start_from: int, [default=0], optional
2269
+ When multiple pages of results are available, the page number to start from.
2270
+ page_size: int, [default=None]
2271
+ The number of items to return in a single page. If not specified, the default will be taken from
2272
+ the class instance.
2255
2273
  Returns
2256
2274
  -------
2257
2275
  List | str
@@ -2272,7 +2290,12 @@ class CollectionManager(Client):
2272
2290
  loop = asyncio.get_event_loop()
2273
2291
  resp = loop.run_until_complete(
2274
2292
  self._async_get_collection_members(
2275
- collection_guid, effective_time, start_from, page_size
2293
+ collection_guid,
2294
+ collection_name,
2295
+ collection_qname,
2296
+ effective_time,
2297
+ start_from,
2298
+ page_size,
2276
2299
  )
2277
2300
  )
2278
2301
 
@@ -2602,15 +2625,24 @@ class CollectionManager(Client):
2602
2625
  )
2603
2626
  return
2604
2627
 
2605
- async def _async_get_member_list(self, root_collection_guid: str) -> list | bool:
2628
+ async def _async_get_member_list(
2629
+ self,
2630
+ collection_guid: str = None,
2631
+ collection_name: str = None,
2632
+ collection_qname: str = None,
2633
+ ) -> list | bool:
2606
2634
  """Get the member list for the collection - async version.
2607
2635
  Parameters
2608
2636
  ----------
2609
- root_collection_guid : str
2610
- The unique GUID of the root collection.
2611
-
2612
-
2613
- The name of the server. If not provided, the default server name will be used.
2637
+ collection_guid: str,
2638
+ identity of the collection to return members for. If none, collection_name or
2639
+ collection_qname are used.
2640
+ collection_name: str,
2641
+ display name of the collection to return members for. If none, collection_guid
2642
+ or collection_qname are used.
2643
+ collection_qname: str,
2644
+ qualified name of the collection to return members for. If none, collection_guid
2645
+ or collection_name are used.
2614
2646
 
2615
2647
  Returns
2616
2648
  -------
@@ -2628,7 +2660,9 @@ class CollectionManager(Client):
2628
2660
 
2629
2661
  # now find the members of the collection
2630
2662
  member_list = []
2631
- members = await self._async_get_collection_members(root_collection_guid)
2663
+ members = await self._async_get_collection_members(
2664
+ collection_guid, collection_name, collection_qname
2665
+ )
2632
2666
  if type(members) is str:
2633
2667
  return False
2634
2668
  # finally, construct a list of member information
@@ -2648,16 +2682,24 @@ class CollectionManager(Client):
2648
2682
 
2649
2683
  return member_list
2650
2684
 
2651
- def get_member_list(self, root_collection_guid: str) -> list | bool:
2652
- """Get the member list for the collection.
2685
+ def get_member_list(
2686
+ self,
2687
+ collection_guid: str = None,
2688
+ collection_name: str = None,
2689
+ collection_qname: str = None,
2690
+ ) -> list | bool:
2691
+ """Get the member list for the collection - async version.
2653
2692
  Parameters
2654
2693
  ----------
2655
- root_collection_guid : str
2656
- The GUID of the root collection.
2657
-
2658
-
2659
- The name of the server. If not provided, the default server name will be used.
2660
-
2694
+ collection_guid: str,
2695
+ identity of the collection to return members for. If none, collection_name or
2696
+ collection_qname are used.
2697
+ collection_name: str,
2698
+ display name of the collection to return members for. If none, collection_guid
2699
+ or collection_qname are used.
2700
+ collection_qname: str,
2701
+ qualified name of the collection to return members for. If none, collection_guid
2702
+ or collection_name are used.
2661
2703
  Returns
2662
2704
  -------
2663
2705
  list | bool
@@ -2671,7 +2713,9 @@ class CollectionManager(Client):
2671
2713
  """
2672
2714
  loop = asyncio.get_event_loop()
2673
2715
  resp = loop.run_until_complete(
2674
- self._async_get_member_list(root_collection_guid)
2716
+ self._async_get_member_list(
2717
+ collection_guid, collection_name, collection_qname
2718
+ )
2675
2719
  )
2676
2720
  return resp
2677
2721
 
@@ -54,11 +54,17 @@ def collection_viewer(
54
54
  """A simple collection viewer"""
55
55
 
56
56
  def walk_collection_hierarchy(
57
- collection_client: CollectionManager, root_collection_name: str, tree: Tree
57
+ tree: Tree,
58
+ collection_client: CollectionManager,
59
+ root_collection_guid: str = None,
60
+ root_collection_name: str = None,
61
+ root_collection_qname: str = None,
58
62
  ) -> None:
59
63
  """Recursively build a Tree with collection contents."""
60
- members = collection_client.get_member_list(root_collection_name)
61
- if members:
64
+ members = collection_client.get_member_list(
65
+ root_collection_guid, root_collection_name, root_collection_qname
66
+ )
67
+ if type(members) is list:
62
68
  for member in members:
63
69
  style = "bold white on black"
64
70
  text_collection_name = Text(
@@ -78,29 +84,27 @@ def collection_viewer(
78
84
  )
79
85
  tt = tree.add(p, style=style)
80
86
 
81
- children = collection_client.get_collection_members(member["guid"])
87
+ children = collection_client.get_collection_members(
88
+ collection_guid=member["guid"]
89
+ )
82
90
  if type(children) is list:
83
91
  branch = tt.add(
84
92
  f"[bold magenta on black]Members",
85
93
  style=style,
86
94
  guide_style=style,
87
95
  )
88
- walk_collection_hierarchy(
89
- collection_client, member["qualifiedName"], branch
90
- ),
96
+ walk_collection_hierarchy(branch, collection_client, member["guid"])
91
97
  else:
92
98
  tt = tree.add(
93
99
  f"[bold magenta on black]No collections match {root_collection_name}"
94
100
  )
95
101
 
96
102
  try:
97
- tree = Tree(
98
- f"[bold bright green on black]{root}", guide_style="bold bright_blue"
99
- )
103
+ tree = Tree(f"[bold bright green]{root}", guide_style="bold bright_blue")
100
104
  c_client = CollectionManager(server_name, platform_url, user_id=user)
101
105
 
102
106
  token = c_client.create_egeria_bearer_token(user, user_password)
103
- walk_collection_hierarchy(c_client, root, tree)
107
+ walk_collection_hierarchy(tree, c_client, None, root)
104
108
  print(tree)
105
109
 
106
110
  except (
@@ -108,7 +112,12 @@ def collection_viewer(
108
112
  PropertyServerException,
109
113
  UserNotAuthorizedException,
110
114
  ) as e:
111
- print_exception_response(e)
115
+ if e.exception_error_message_parameters[1] == "No elements found":
116
+ print("The collection was not found.")
117
+ else:
118
+ print_exception_response(e)
119
+ finally:
120
+ c_client.close_session()
112
121
 
113
122
 
114
123
  def main():
@@ -128,7 +137,7 @@ def main():
128
137
  try:
129
138
  root_collection = Prompt.ask(
130
139
  "Enter the Root Collection to start from:",
131
- default="Root Sustainability Collection",
140
+ default="Digital Products Root",
132
141
  )
133
142
  collection_viewer(root_collection, server, url, userid, user_pass)
134
143
  except KeyboardInterrupt:
@@ -7,7 +7,6 @@ A simple display for collections
7
7
  """
8
8
  import argparse
9
9
  import os
10
- import sys
11
10
  import time
12
11
 
13
12
  from rich import box
@@ -92,7 +91,7 @@ def display_collections(
92
91
  table.add_column("Collection Type")
93
92
 
94
93
  collections = m_client.find_collections(
95
- search_string, None, False, ends_with=False, ignore_case=True
94
+ search_string.strip(), None, False, ends_with=False, ignore_case=True
96
95
  )
97
96
  if type(collections) is list:
98
97
  sorted_collection_list = sorted(
@@ -121,8 +120,14 @@ def display_collections(
121
120
  force_terminal=not jupyter,
122
121
  )
123
122
  console.print(table)
124
-
125
- except (InvalidParameterException, PropertyServerException) as e:
123
+ else:
124
+ print("==> No collections with that name found")
125
+
126
+ except (
127
+ InvalidParameterException,
128
+ UserNotAuthorizedException,
129
+ PropertyServerException,
130
+ ) as e:
126
131
  print_exception_response(e)
127
132
  finally:
128
133
  m_client.close_session()
@@ -145,7 +150,7 @@ def main():
145
150
  try:
146
151
  search_string = Prompt.ask(
147
152
  "Enter the collection you are searching for or '*' for all:", default="*"
148
- )
153
+ ).strip()
149
154
 
150
155
  display_collections(search_string, server, url, userid, user_pass)
151
156
 
@@ -87,7 +87,7 @@ def list_deployed_database_schemas(
87
87
  def generate_table() -> Table:
88
88
  """Make a new table."""
89
89
  table = Table(
90
- title=f"Database Schema List @ {time.asctime()}",
90
+ title=f"Catalog Schema List @ {time.asctime()}",
91
91
  caption=f"Databases found: {view_url} - {view_server} @ {time.asctime()}",
92
92
  style="bold bright_white on black",
93
93
  row_styles=["bold bright_white on black"],
@@ -96,17 +96,12 @@ def list_deployed_database_schemas(
96
96
  caption_style="white on black",
97
97
  show_lines=True,
98
98
  box=box.ROUNDED,
99
- # title=f"Elements for Open Metadata Type: '{om_type}' ",
100
99
  expand=True,
101
100
  # width=500
102
101
  )
103
102
 
104
103
  table.add_column("Schema in Catalog")
105
104
  table.add_column("Schema Properties")
106
-
107
- # table.add_column("Home Store")
108
- # table.add_column("GUID", width=38, no_wrap=True)
109
- # table.add_column("Properties")
110
105
  table.add_column("Cataloged Resource")
111
106
 
112
107
  om_type = "DeployedDatabaseSchema"
@@ -139,18 +134,21 @@ def list_deployed_database_schemas(
139
134
  # get the information about the catalog we are part of
140
135
  el_classification = header["classifications"]
141
136
  for c in el_classification:
137
+ el_cat_guid = "---"
142
138
  if c["type"]["typeName"] == "Anchors":
143
139
  el_anchor_guid = c["classificationProperties"]["anchorGUID"]
144
140
  el_anchor_type_name = c["classificationProperties"][
145
141
  "anchorTypeName"
146
142
  ]
147
- if el_anchor_type_name == "Catalog":
143
+ el_anchor_domain_name = c["classificationProperties"][
144
+ "anchorDomainName"
145
+ ]
146
+ el_cat_name = "---"
147
+ if el_anchor_domain_name == "SoftwareCapability":
148
148
  el_cat = c_client.get_element_by_guid(el_anchor_guid)
149
149
  el_cat_name = el_cat["properties"].get("name", None)
150
150
  if el_cat_name is None:
151
- el_cat_name = el_cat["properties"].get(
152
- "qualifiedName", "---"
153
- )
151
+ el_cat_name = el_cat["properties"].get("qualifiedName", "")
154
152
  el_cat_guid = el_cat["elementHeader"]["guid"]
155
153
  el_schema_id = (
156
154
  f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
@@ -203,10 +201,6 @@ def list_deployed_database_schemas(
203
201
 
204
202
  table.add_row(
205
203
  el_schema_id,
206
- # el_type,
207
- # el_created_out,
208
- # el_home,
209
- # el_guid,
210
204
  el_props_out,
211
205
  rel_el_out,
212
206
  )