pyegeria 1.5.1.1.6__py3-none-any.whl → 1.5.1.1.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.
@@ -13,10 +13,15 @@ import os
13
13
  import sys
14
14
  import time
15
15
  from datetime import datetime
16
+ from rich import box
17
+ from rich.console import Console
18
+ from rich.prompt import Prompt
19
+ from rich.table import Table
20
+ from rich.text import Text
16
21
 
17
22
  import click
18
23
 
19
- # from ops_config import Config, pass_config
24
+
20
25
  from pyegeria import EgeriaTech, body_slimmer
21
26
  from pyegeria._exceptions import (
22
27
  InvalidParameterException,
@@ -40,6 +45,8 @@ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
40
45
  EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
41
46
  EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
42
47
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
48
+ EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 200)
49
+ EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
43
50
 
44
51
 
45
52
  @click.command("create-glossary")
@@ -88,7 +95,7 @@ def create_glossary(
88
95
  )
89
96
  sys.exit(0)
90
97
 
91
- glossary_guid = m_client.create_glossary(name, language, description, usage)
98
+ glossary_guid = m_client.create_glossary(name, description, language, usage)
92
99
  print(f"New glossary {name} created with id of {glossary_guid}")
93
100
 
94
101
  except (InvalidParameterException, PropertyServerException) as e:
@@ -97,6 +104,64 @@ def create_glossary(
97
104
  m_client.close_session()
98
105
 
99
106
 
107
+ @click.command("list-glossaries")
108
+ @click.option("--search-string", default="*", help="Glossaries to search for")
109
+ @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
110
+ @click.option(
111
+ "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
112
+ )
113
+ @click.option("--userid", default=EGERIA_USER, help="Egeria user")
114
+ @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
115
+ @click.option("--timeout", default=60, help="Number of seconds to wait")
116
+ def list_glossaries(search_string, server, url, userid, password, timeout):
117
+ """List all glossaries"""
118
+ m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
119
+ token = m_client.create_egeria_bearer_token()
120
+ try:
121
+ table = Table(
122
+ title=f"Glossary List @ {time.asctime()}",
123
+ style="bright_white on black",
124
+ header_style="bright_white on dark_blue",
125
+ title_style="bold white on black",
126
+ caption_style="white on black",
127
+ show_lines=True,
128
+ box=box.ROUNDED,
129
+ caption=f"View Server '{server}' @ Platform - {url}",
130
+ expand=True,
131
+ )
132
+ table.add_column("Glossary Name")
133
+ table.add_column("Qualified Name / GUID")
134
+ table.add_column("Language")
135
+ table.add_column("Description")
136
+ table.add_column("Usage")
137
+
138
+ glossaries = m_client.find_glossaries(search_string)
139
+ if type(glossaries) is list:
140
+ sorted_glossary_list = sorted(
141
+ glossaries, key=lambda k: k["glossaryProperties"]["displayName"]
142
+ )
143
+ for glossary in sorted_glossary_list:
144
+ display_name = glossary["glossaryProperties"]["displayName"]
145
+ qualified_name = glossary["glossaryProperties"]["qualifiedName"]
146
+ guid = glossary["elementHeader"]["guid"]
147
+ q_name = f"{qualified_name}\n\n{guid}"
148
+ language = glossary["glossaryProperties"]["language"]
149
+ description = glossary["glossaryProperties"]["description"]
150
+ usage = glossary["glossaryProperties"]["usage"]
151
+ table.add_row(display_name, q_name, language, description, usage)
152
+ console = Console(
153
+ style="bold bright_white on black",
154
+ width=EGERIA_WIDTH,
155
+ force_terminal=not EGERIA_JUPYTER,
156
+ )
157
+ console.print(table)
158
+
159
+ except (InvalidParameterException, PropertyServerException) as e:
160
+ print_exception_response(e)
161
+ finally:
162
+ m_client.close_session()
163
+
164
+
100
165
  @click.command("delete-glossary")
101
166
  @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
102
167
  @click.option(
@@ -68,10 +68,10 @@ def display_glossary_terms(
68
68
  caption_style="white on black",
69
69
  show_lines=True,
70
70
  box=box.ROUNDED,
71
- caption=f"Glossary View Server '{server}' @ Platform - {url}",
71
+ caption=f"View Server '{server}' @ Platform - {url}",
72
72
  expand=True,
73
73
  )
74
- table.add_column("Display Name")
74
+ table.add_column("Term Name")
75
75
  table.add_column("Qualified Name")
76
76
 
77
77
  table.add_column("Abbreviation")
commands/cli/egeria.py CHANGED
@@ -20,7 +20,7 @@ from commands.cat.get_tech_type_elements import tech_viewer
20
20
  from commands.cat.get_tech_type_template import template_viewer
21
21
  from commands.cat.list_assets import display_assets
22
22
  from commands.cat.list_cert_types import display_certifications
23
- from commands.cat.list_glossary import display_glossary_terms
23
+ from commands.cat.list_terms import display_glossary_terms
24
24
  from commands.cat.list_projects import display_project_list
25
25
  from commands.cat.list_relationships import list_relationships
26
26
  from commands.cat.list_tech_types import display_tech_types
@@ -40,6 +40,7 @@ from commands.cat.list_deployed_databases import list_deployed_databases
40
40
  from commands.cat.glossary_actions import (
41
41
  create_glossary,
42
42
  delete_glossary,
43
+ list_glossaries,
43
44
  create_term,
44
45
  load_terms,
45
46
  )
@@ -970,6 +971,8 @@ def list_databases(ctx):
970
971
  )
971
972
 
972
973
 
974
+ show.add_command(list_glossaries)
975
+
973
976
  #
974
977
  # Catalog User: Tell
975
978
  #
@@ -23,6 +23,7 @@ from commands.cat.glossary_actions import (
23
23
  delete_glossary,
24
24
  create_term,
25
25
  load_terms,
26
+ list_glossaries,
26
27
  )
27
28
  from commands.cat.list_archives import display_archive_list
28
29
  from commands.cat.list_assets import display_assets
@@ -32,7 +33,7 @@ from commands.cat.list_deployed_database_schemas import (
32
33
  list_deployed_database_schemas,
33
34
  )
34
35
  from commands.cat.list_deployed_databases import list_deployed_databases
35
- from commands.cat.list_glossary import display_glossary_terms
36
+ from commands.cat.list_terms import display_glossary_terms
36
37
  from commands.cat.list_projects import display_project_list
37
38
  from commands.cat.list_relationships import list_relationships
38
39
  from commands.cat.list_tech_types import display_tech_types
@@ -552,6 +553,8 @@ def list_databases(ctx):
552
553
  )
553
554
 
554
555
 
556
+ show.add_command(list_glossaries)
557
+
555
558
  #
556
559
  # Tell
557
560
  #
@@ -10,6 +10,7 @@ import asyncio
10
10
  import time
11
11
  import csv
12
12
  from datetime import datetime
13
+ from typing import List
13
14
 
14
15
  from pyegeria import InvalidParameterException
15
16
 
@@ -1417,7 +1418,7 @@ class GlossaryManager(GlossaryBrowser):
1417
1418
 
1418
1419
  def load_terms_from_file(
1419
1420
  self, glossary_name: str, filename: str, upsert: bool = False
1420
- ) -> [dict]:
1421
+ ) -> List[dict]:
1421
1422
  """This method loads glossary terms into the specified glossary from the indicated file."""
1422
1423
  # Check that glossary exists and get guid
1423
1424
  glossaries = self.get_glossaries_by_name(glossary_name)
@@ -1437,7 +1438,6 @@ class GlossaryManager(GlossaryBrowser):
1437
1438
 
1438
1439
  # Now we know we have a single glossary so we can get the guid
1439
1440
  glossary_guid = glossaries[0]["elementHeader"]["guid"]
1440
- term_info = []
1441
1441
 
1442
1442
  term_properties = {
1443
1443
  "Term Name",
@@ -1455,6 +1455,7 @@ class GlossaryManager(GlossaryBrowser):
1455
1455
  # Create a CSV reader object
1456
1456
  csv_reader = csv.DictReader(file)
1457
1457
  headers = csv_reader.fieldnames
1458
+ term_info = []
1458
1459
  # check that the column headers are known
1459
1460
  if all(header in term_properties for header in headers) is False:
1460
1461
  raise InvalidParameterException("Invalid headers in CSV File")
@@ -1473,23 +1474,23 @@ class GlossaryManager(GlossaryBrowser):
1473
1474
  status = row.get("Status", "DRAFT").upper()
1474
1475
 
1475
1476
  # process the row
1476
- if term_name is None:
1477
+ if len(term_name) < 2:
1477
1478
  term_info.append(
1478
1479
  {
1479
- {"term_name": "---"},
1480
- {"qualified_name": "---"},
1481
- {"term_guid": "---"},
1482
- {"error": "missing term names - skipping"},
1480
+ "term_name": "---",
1481
+ "qualified_name": "---",
1482
+ "term_guid": "---",
1483
+ "error": "missing or invalid term names - skipping",
1483
1484
  }
1484
1485
  )
1485
1486
  continue
1486
1487
  if self.__validate_term_status__(status) is False:
1487
1488
  term_info.append(
1488
1489
  {
1489
- {"term_name": "---"},
1490
- {"qualified_name": "---"},
1491
- {"term_guid": "---"},
1492
- {"error": "invalid term status"},
1490
+ "term_name": "---",
1491
+ "qualified_name": "---",
1492
+ "term_guid": "---",
1493
+ "error": "invalid term status",
1493
1494
  }
1494
1495
  )
1495
1496
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 1.5.1.1.6
3
+ Version: 1.5.1.1.7
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -6,22 +6,22 @@ commands/cat/get_project_dependencies.py,sha256=B0JaMSUi0hzVgos1sTY2uUPGy1DzKEJM
6
6
  commands/cat/get_project_structure.py,sha256=n2GbNd07w1DTo7jTR8b2ewXRyNcat_2BcCBRyDMldwk,5969
7
7
  commands/cat/get_tech_type_elements.py,sha256=-m3Q0BoNqkCtV8h75vMwTcOV-_ymEXmnJcr4Ec7WMAw,6180
8
8
  commands/cat/get_tech_type_template.py,sha256=gMFVcgCIm09GQu1Vsc5ZUVH9XLhItAG1eVGZJrcnHeQ,6174
9
- commands/cat/glossary_actions.py,sha256=KbSiMseXgQLdoT8TqXocl3WpE_gqalkxjxRuGZCzFw8,8775
9
+ commands/cat/glossary_actions.py,sha256=cln_aGvkJ-aOZG_pHQE81G5MxHWILXKYYrDa4-HJJzY,11602
10
10
  commands/cat/list_archives.py,sha256=FEZ2XYnQIWo2PztWqnj6unn0pbblPU0-bMbTyI3csv4,5464
11
11
  commands/cat/list_assets.py,sha256=bNwSaBDz661hfnc2Rn4j4HPHAugKvz0XwN9L1m4FVQk,6529
12
12
  commands/cat/list_cert_types.py,sha256=mbCls_EqC5JKG5rvS4o69k7KgZ6aNXlcqoJ3DtHsTFA,7127
13
13
  commands/cat/list_deployed_catalogs.py,sha256=eG8K-d7BijD34el_yVx9yfnLJdfwTUiJVxd-gcGwo7k,7157
14
14
  commands/cat/list_deployed_database_schemas.py,sha256=HNAR8qXU7FWUxPJw6yBxmlsJ_eVXqsD_DrswKmY1iv0,8824
15
15
  commands/cat/list_deployed_databases.py,sha256=HE8nG-mIlxa9iSUEH-n71o-G2a4ss1Zzalq7YJQIix0,6668
16
- commands/cat/list_glossary.py,sha256=tUtQQoTGTlDLU-yFbfO3zjiJC9QyEJfg8NxnGCo2mnI,5811
17
16
  commands/cat/list_projects.py,sha256=Jzs-DtIpPhCH-gY4PYT6mnRBWnEf4m18TFfcw8UymNU,8011
18
17
  commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468GYw3Q,5869
19
18
  commands/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
19
+ commands/cat/list_terms.py,sha256=Eckpd4Y0RojuwWRy-dpft8dMtYQvHpe7bBvlsAAvbAE,5799
20
20
  commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnUI79ir4,6542
21
21
  commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
22
22
  commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
23
- commands/cli/egeria.py,sha256=HeGF9WbUXZQjUFsjuHZDBFki8nt4QxRqDUpa-0uf3Jg,31327
24
- commands/cli/egeria_cat.py,sha256=r0eseanfHszfi0K26weWiQn0XstzwN7CoaNv9-zbqGg,14862
23
+ commands/cli/egeria.py,sha256=2TUbDYeKoqU5ihFq2HbHxZjycwiW4rqdpv2ivDQEV6o,31380
24
+ commands/cli/egeria_cat.py,sha256=ED--LsHKn94lxuyv8w46lhfnRNido-hOnbBBgrTwHMc,14915
25
25
  commands/cli/egeria_my.py,sha256=9zIpUDLeA_R-0rgCSQfEZTtVmkxPcEAsYcCTn1wQFrE,6181
26
26
  commands/cli/egeria_ops.py,sha256=fxDXYWXRhexx06PdSLCp2FhgUtS13NdDpyg7ea775fc,11531
27
27
  commands/cli/egeria_tech.py,sha256=eTDHTHDVEYmr6gUPGfido_Uf7Fec0Nuyxlkhg4KAMAw,13160
@@ -92,7 +92,7 @@ pyegeria/egeria_tech_client.py,sha256=7NfqpJFft5GR4NPRDVDw22L9caHbXB8fhx0TAf6qEo
92
92
  pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3euNiro,152931
93
93
  pyegeria/full_omag_server_config.py,sha256=LBnqUiz1ofBdlKBzECFs_pQbdJwcWigAukWHGJRR2nU,47340
94
94
  pyegeria/glossary_browser_omvs.py,sha256=NcitYaZJqwVODBO5zBtWpXPNUJJ3DKzEbRaOFSAyUlg,93554
95
- pyegeria/glossary_manager_omvs.py,sha256=Nnk0cnpU4zJodIgEs7sqLTldd0fF2gKcMt2FBgSlAPI,116815
95
+ pyegeria/glossary_manager_omvs.py,sha256=UImHe9UKaiMPazh_pvTEFroNIfVAG4rPtUrXrwN9DKk,116843
96
96
  pyegeria/mermaid_utilities.py,sha256=GXiS-subb5nJcDqlThZWX2T8WspU1neFfhf4TxRoMh4,8344
97
97
  pyegeria/my_profile_omvs.py,sha256=DyECbUFEcgokrIbzdMMNljC3bqfqKGXAF2wZEpzvRYs,34666
98
98
  pyegeria/platform_services.py,sha256=CJIOYIFEbcIGwdWlApAQcXxZTsdrhFtpJcm4O3p7dG0,41646
@@ -104,8 +104,8 @@ pyegeria/template_manager_omvs.py,sha256=heqbKeum5hPCHap4r1RUZU8YB3QaQlxVNbq4GZi
104
104
  pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
105
105
  pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
106
106
  pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
107
- pyegeria-1.5.1.1.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
108
- pyegeria-1.5.1.1.6.dist-info/METADATA,sha256=7Eisg_5cSqYJpOCf4ZkxAizYWVz5YR-ZMIw0hUdpfQw,2997
109
- pyegeria-1.5.1.1.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
110
- pyegeria-1.5.1.1.6.dist-info/entry_points.txt,sha256=eQF0CAWVQlHftl85JzL0pWSaQ1eURJ6MeI1I78FvAgQ,4127
111
- pyegeria-1.5.1.1.6.dist-info/RECORD,,
107
+ pyegeria-1.5.1.1.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
108
+ pyegeria-1.5.1.1.7.dist-info/METADATA,sha256=3d-S8G-NEnHy64vcqaQDw3bhwQ2e-WNDq72hWfPJ4jM,2997
109
+ pyegeria-1.5.1.1.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
110
+ pyegeria-1.5.1.1.7.dist-info/entry_points.txt,sha256=aSpiaOuOEL1QBfuIGOaATzDCihpVOyvIK1XCQHK3uRc,4186
111
+ pyegeria-1.5.1.1.7.dist-info/RECORD,,
@@ -32,6 +32,7 @@ list_elements=commands.tech.list_elements:main
32
32
  list_elements_for_classification=commands.tech.list_elements_for_classification:main
33
33
  list_engine_activity=commands.ops.monitor_engine_activity:main_paging
34
34
  list_engine_activity_compressed=commands.ops.monitor_engine_activity_c:main_paging
35
+ list_glossaries=commands.cat.glossary_actions:list_glossaries
35
36
  list_gov_action_processes=commands.tech.list_gov_action_processes:main
36
37
  list_gov_eng_status=commands.ops.monitor_gov_eng_status:main_paging
37
38
  list_integ_daemon_status=commands.ops.monitor_integ_daemon_status:main_paging
@@ -44,7 +45,7 @@ list_relationship_types=commands.tech.list_relationship_types:main
44
45
  list_relationships=commands.cat.list_relationships:main
45
46
  list_tech_templates=commands.tech.list_tech_templates:main
46
47
  list_tech_types=commands.cat.list_tech_types:main
47
- list_terms=commands.cat.list_glossary:main
48
+ list_terms=commands.cat.list_terms:main
48
49
  list_todos=commands.cat.list_todos:main
49
50
  list_user_ids=commands.cat.list_user_ids:main
50
51
  list_valid_metadata_values=commands.tech.list_valid_metadata_values:main