pyegeria 1.5.1.0.21__py3-none-any.whl → 1.5.1.0.23__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/glossary_actions.py +35 -4
- commands/cli/egeria.py +7 -1
- commands/cli/egeria_cat.py +7 -1
- commands/tech/list_tech_templates.py +4 -4
- pyegeria/glossary_manager_omvs.py +76 -9
- {pyegeria-1.5.1.0.21.dist-info → pyegeria-1.5.1.0.23.dist-info}/METADATA +1 -1
- {pyegeria-1.5.1.0.21.dist-info → pyegeria-1.5.1.0.23.dist-info}/RECORD +10 -10
- {pyegeria-1.5.1.0.21.dist-info → pyegeria-1.5.1.0.23.dist-info}/entry_points.txt +2 -1
- {pyegeria-1.5.1.0.21.dist-info → pyegeria-1.5.1.0.23.dist-info}/LICENSE +0 -0
- {pyegeria-1.5.1.0.21.dist-info → pyegeria-1.5.1.0.23.dist-info}/WHEEL +0 -0
commands/cat/glossary_actions.py
CHANGED
@@ -7,6 +7,7 @@ Copyright Contributors to the ODPi Egeria project.
|
|
7
7
|
Execute Glossary actions.
|
8
8
|
|
9
9
|
"""
|
10
|
+
import csv
|
10
11
|
import os
|
11
12
|
import sys
|
12
13
|
import time
|
@@ -111,7 +112,7 @@ def delete_glossary(server, url, userid, password, timeout, glossary_guid):
|
|
111
112
|
try:
|
112
113
|
m_client.delete_to_do(glossary_guid)
|
113
114
|
|
114
|
-
click.echo(f"Deleted
|
115
|
+
click.echo(f"Deleted glossary: {glossary_guid}")
|
115
116
|
|
116
117
|
except (InvalidParameterException, PropertyServerException) as e:
|
117
118
|
print_exception_response(e)
|
@@ -156,7 +157,6 @@ def create_term(
|
|
156
157
|
url,
|
157
158
|
userid,
|
158
159
|
password,
|
159
|
-
timeout,
|
160
160
|
glossary_name,
|
161
161
|
term_name,
|
162
162
|
summary,
|
@@ -166,7 +166,8 @@ def create_term(
|
|
166
166
|
usage,
|
167
167
|
version,
|
168
168
|
status,
|
169
|
-
|
169
|
+
timeout: int = 120,
|
170
|
+
) -> str:
|
170
171
|
"""Create a new term"""
|
171
172
|
m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
|
172
173
|
token = m_client.create_egeria_bearer_token()
|
@@ -175,7 +176,7 @@ def create_term(
|
|
175
176
|
"class": "ReferenceableRequestBody",
|
176
177
|
"elementProperties": {
|
177
178
|
"class": "GlossaryTermProperties",
|
178
|
-
"qualifiedName": f"GlossaryTerm: {term_name}
|
179
|
+
"qualifiedName": f"GlossaryTerm: {term_name} - {datetime.now().isoformat()}",
|
179
180
|
"displayName": term_name,
|
180
181
|
"summary": summary,
|
181
182
|
"description": description,
|
@@ -205,6 +206,36 @@ def create_term(
|
|
205
206
|
click.echo(
|
206
207
|
f"Successfully created term {term_name} with GUID {term_guid}, in glossary {glossary_name}.\n"
|
207
208
|
)
|
209
|
+
return term_guid
|
210
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
211
|
+
print_exception_response(e)
|
212
|
+
finally:
|
213
|
+
m_client.close_session()
|
214
|
+
|
215
|
+
|
216
|
+
@click.command("load-terms-from-file")
|
217
|
+
@click.option("--glossary-name", help="Name of Glossary", required=True)
|
218
|
+
@click.option("--file-name", help="Path of CSV file", required=True)
|
219
|
+
@click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
|
220
|
+
@click.option(
|
221
|
+
"--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
|
222
|
+
)
|
223
|
+
@click.option("--userid", default=EGERIA_USER, help="Egeria user")
|
224
|
+
@click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
|
225
|
+
@click.option("--timeout", default=60, help="Number of seconds to wait")
|
226
|
+
@click.argument("glossary-guid")
|
227
|
+
def load_terms(
|
228
|
+
glossary_name, file_name, server, url, userid, password, timeout, glossary_guid
|
229
|
+
):
|
230
|
+
"""Delete the glossary specified"""
|
231
|
+
m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
|
232
|
+
token = m_client.create_egeria_bearer_token()
|
233
|
+
try:
|
234
|
+
result = m_client.load_terms_from_file(glossary_name, file_name)
|
235
|
+
|
236
|
+
click.echo(
|
237
|
+
f"Loaded terms from into glossary: {glossary_name} from {file_name}"
|
238
|
+
)
|
208
239
|
|
209
240
|
except (InvalidParameterException, PropertyServerException) as e:
|
210
241
|
print_exception_response(e)
|
commands/cli/egeria.py
CHANGED
@@ -37,7 +37,12 @@ from commands.cat.list_deployed_database_schemas import (
|
|
37
37
|
)
|
38
38
|
from commands.cat.list_deployed_catalogs import list_deployed_catalogs
|
39
39
|
from commands.cat.list_deployed_databases import list_deployed_databases
|
40
|
-
from commands.cat.glossary_actions import
|
40
|
+
from commands.cat.glossary_actions import (
|
41
|
+
create_glossary,
|
42
|
+
delete_glossary,
|
43
|
+
create_term,
|
44
|
+
load_terms,
|
45
|
+
)
|
41
46
|
from commands.my.todo_actions import (
|
42
47
|
mark_todo_complete,
|
43
48
|
reassign_todo,
|
@@ -984,6 +989,7 @@ tell.add_command(mark_todo_complete)
|
|
984
989
|
tell.add_command(reassign_todo)
|
985
990
|
tell.add_command(delete_todo)
|
986
991
|
tell.add_command(create_todo)
|
992
|
+
tell.add_command(load_terms)
|
987
993
|
|
988
994
|
|
989
995
|
@tell.group("survey")
|
commands/cli/egeria_cat.py
CHANGED
@@ -18,7 +18,12 @@ from commands.cat.get_project_dependencies import project_dependency_viewer
|
|
18
18
|
from commands.cat.get_project_structure import project_structure_viewer
|
19
19
|
from commands.cat.get_tech_type_elements import tech_viewer
|
20
20
|
from commands.cat.get_tech_type_template import template_viewer
|
21
|
-
from commands.cat.glossary_actions import
|
21
|
+
from commands.cat.glossary_actions import (
|
22
|
+
create_glossary,
|
23
|
+
delete_glossary,
|
24
|
+
create_term,
|
25
|
+
load_terms,
|
26
|
+
)
|
22
27
|
from commands.cat.list_archives import display_archive_list
|
23
28
|
from commands.cat.list_assets import display_assets
|
24
29
|
from commands.cat.list_cert_types import display_certifications
|
@@ -566,6 +571,7 @@ tell.add_command(mark_todo_complete)
|
|
566
571
|
tell.add_command(reassign_todo)
|
567
572
|
tell.add_command(delete_todo)
|
568
573
|
tell.add_command(create_todo)
|
574
|
+
tell.add_command(load_terms)
|
569
575
|
|
570
576
|
|
571
577
|
@tell.group("survey")
|
@@ -49,7 +49,6 @@ def list_templates(
|
|
49
49
|
tech_info_list: dict = []
|
50
50
|
|
51
51
|
if type(tech_list) is list:
|
52
|
-
entry = {}
|
53
52
|
for item in tech_list:
|
54
53
|
if "deployedImplementationType" not in item["qualifiedName"]:
|
55
54
|
continue
|
@@ -66,7 +65,8 @@ def list_templates(
|
|
66
65
|
for template in templates:
|
67
66
|
t_list.append({"template": template["name"]})
|
68
67
|
entry[details["name"]] = t_list
|
69
|
-
|
68
|
+
tech_info_list.append(entry)
|
69
|
+
return tech_info_list
|
70
70
|
|
71
71
|
|
72
72
|
def display_templates_spec(
|
@@ -194,8 +194,8 @@ def main():
|
|
194
194
|
search_string = Prompt.ask(
|
195
195
|
"Enter the technology you are searching for:", default="*"
|
196
196
|
)
|
197
|
-
display_templates_spec(search_string, server, url, userid, password)
|
198
|
-
|
197
|
+
# display_templates_spec(search_string, server, url, userid, password)
|
198
|
+
list_templates(search_string, server, url, userid, password)
|
199
199
|
except KeyboardInterrupt:
|
200
200
|
pass
|
201
201
|
|
@@ -8,8 +8,11 @@ added in subsequent versions of the glossary_omvs module.
|
|
8
8
|
"""
|
9
9
|
import asyncio
|
10
10
|
import time
|
11
|
+
import csv
|
11
12
|
from datetime import datetime
|
12
13
|
|
14
|
+
from pyegeria import InvalidParameterException
|
15
|
+
|
13
16
|
# import json
|
14
17
|
from pyegeria._client import Client
|
15
18
|
from pyegeria._validators import (
|
@@ -1407,28 +1410,92 @@ class GlossaryManager(GlossaryBrowser):
|
|
1407
1410
|
|
1408
1411
|
def load_terms_from_file(
|
1409
1412
|
self, glossary_name: str, filename: str, upsert: bool = False
|
1410
|
-
) ->
|
1413
|
+
) -> [dict]:
|
1411
1414
|
"""This method loads glossary terms into the specified glossary from the indicated file."""
|
1412
1415
|
# Check that glossary exists and get guid
|
1413
1416
|
glossaries = self.get_glossaries_by_name(glossary_name)
|
1414
1417
|
if type(glossaries) is not list:
|
1415
1418
|
return "Unknown glossary"
|
1416
1419
|
if len(glossaries) > 1:
|
1420
|
+
glossary_error = (
|
1421
|
+
"Multiple glossaries found - please use a qualified name from below\n"
|
1422
|
+
)
|
1417
1423
|
for g in glossaries:
|
1418
|
-
glossary_error = (
|
1419
|
-
"Multiple glossaries found - please use the qualified name\n"
|
1420
|
-
)
|
1421
1424
|
glossary_error += (
|
1422
1425
|
f"Display Name: {g['glossaryProperties']['displayName']}\tQualified Name:"
|
1423
1426
|
f" {g['glossaryProperties']['qualifiedName']}\n"
|
1424
1427
|
)
|
1425
|
-
|
1426
|
-
|
1428
|
+
raise InvalidParameterException(glossary_error)
|
1429
|
+
sys.exit(1)
|
1427
1430
|
|
1428
|
-
#
|
1431
|
+
# Now we know we have a single glossary so we can get the guid
|
1432
|
+
glossary_guid = glossaries[0]["elementHeader"]["guid"]
|
1433
|
+
term_info = []
|
1434
|
+
|
1435
|
+
term_properties = {
|
1436
|
+
"Term Name",
|
1437
|
+
"Qualified Name",
|
1438
|
+
"Abbreviation",
|
1439
|
+
"Summary",
|
1440
|
+
"Description",
|
1441
|
+
"Examples",
|
1442
|
+
"Usage",
|
1443
|
+
"Version Identifier",
|
1444
|
+
"Status",
|
1445
|
+
}
|
1446
|
+
# process file
|
1447
|
+
with open(filename, mode="r") as file:
|
1448
|
+
# Create a CSV reader object
|
1449
|
+
csv_reader = csv.DictReader(file)
|
1450
|
+
headers = csv_reader.fieldnames
|
1451
|
+
# check that the column headers are known
|
1452
|
+
if all(header in term_properties for header in headers) is False:
|
1453
|
+
raise InvalidParameterException("Invalid headers in CSV File")
|
1454
|
+
sys.exit(1)
|
1455
|
+
|
1456
|
+
# process each row
|
1457
|
+
for row in csv_reader:
|
1458
|
+
term_name = row.get("Term Name", None)
|
1459
|
+
qualified_name = row.get("Qualified Name", None)
|
1460
|
+
abbrev = row.get("Abbreviation", None)
|
1461
|
+
summary = row.get("Summary", None)
|
1462
|
+
description = row.get("Description", None)
|
1463
|
+
examples = row.get("Examples", None)
|
1464
|
+
usage = row.get("Usage", None)
|
1465
|
+
version = row.get("Version Identifier", "1.0")
|
1466
|
+
status = row.get("Status", "DRAFT").upper()
|
1467
|
+
|
1468
|
+
# process the row
|
1469
|
+
if term_name is None:
|
1470
|
+
continue
|
1471
|
+
body = {
|
1472
|
+
"class": "ReferenceableRequestBody",
|
1473
|
+
"elementProperties": {
|
1474
|
+
"class": "GlossaryTermProperties",
|
1475
|
+
"qualifiedName": f"GlossaryTerm: {term_name} - {datetime.now().isoformat()}",
|
1476
|
+
"displayName": term_name,
|
1477
|
+
"summary": summary,
|
1478
|
+
"description": description,
|
1479
|
+
"abbreviation": abbrev,
|
1480
|
+
"examples": examples,
|
1481
|
+
"usage": usage,
|
1482
|
+
"publishVersionIdentifier": version,
|
1483
|
+
},
|
1484
|
+
"initialStatus": status,
|
1485
|
+
}
|
1429
1486
|
|
1430
|
-
|
1431
|
-
|
1487
|
+
# Add the term
|
1488
|
+
term_guid = self.create_controlled_glossary_term(
|
1489
|
+
glossary_guid, body_slimmer(body)
|
1490
|
+
)
|
1491
|
+
term_info.append(
|
1492
|
+
{
|
1493
|
+
"term_name": term_name,
|
1494
|
+
"qualified_name": qualified_name,
|
1495
|
+
"term_guid": term_guid,
|
1496
|
+
}
|
1497
|
+
)
|
1498
|
+
return term_info
|
1432
1499
|
|
1433
1500
|
async def _async_create_term_copy(
|
1434
1501
|
self,
|
@@ -6,7 +6,7 @@ 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=
|
9
|
+
commands/cat/glossary_actions.py,sha256=NL9Cd7dCjbcfz4OxYIT10yprfJWmRX8JwaA5_66GQBE,8585
|
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
|
@@ -20,8 +20,8 @@ commands/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFo
|
|
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=
|
24
|
-
commands/cli/egeria_cat.py,sha256=
|
23
|
+
commands/cli/egeria.py,sha256=HeGF9WbUXZQjUFsjuHZDBFki8nt4QxRqDUpa-0uf3Jg,31327
|
24
|
+
commands/cli/egeria_cat.py,sha256=r0eseanfHszfi0K26weWiQn0XstzwN7CoaNv9-zbqGg,14862
|
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
|
@@ -67,7 +67,7 @@ commands/tech/list_registered_services.py,sha256=QzE_ebdopNkHWMxa-xc902GG6ac4Yw-
|
|
67
67
|
commands/tech/list_related_elements.py,sha256=mcOy3RIGpIdshcT1o4Tr7Ck-c1dmAC8yBUOF5GAFYrM,7755
|
68
68
|
commands/tech/list_related_specification.py,sha256=mWrKenXOskL4cl0DHjH2Z8M9-FJzjkzK62W-tsx3WDU,5918
|
69
69
|
commands/tech/list_relationship_types.py,sha256=BlVzrPznZXqMVLN2-2vYEVRGeYsiJrqXxIJEikobyoo,5875
|
70
|
-
commands/tech/list_tech_templates.py,sha256=
|
70
|
+
commands/tech/list_tech_templates.py,sha256=doQtfSrbnluCzyCsq2PCDGKk5atDPXPDuu24YjCRxo0,7832
|
71
71
|
commands/tech/list_valid_metadata_values.py,sha256=N3D0_BmREPszgde3uvvYdfzq7DJ46uMOv2t1vtncGsw,6333
|
72
72
|
commands/tech/table_tech_templates.py,sha256=xa_mA10P_6Su3zRsvyoZhWoSUQ5LuyLTG1kNCumzxZA,7268
|
73
73
|
commands/tech/x_list_related_elements.py,sha256=qBsf1619cecaMCTzG0MG22fAT32WNH2Z3CXrjo9z-5Y,5853
|
@@ -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=
|
95
|
+
pyegeria/glossary_manager_omvs.py,sha256=Ui3LXiI5kyYXpJ35sn2pI4gB5XoAOXEKr6fWsZlCZrI,115642
|
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.0.
|
108
|
-
pyegeria-1.5.1.0.
|
109
|
-
pyegeria-1.5.1.0.
|
110
|
-
pyegeria-1.5.1.0.
|
111
|
-
pyegeria-1.5.1.0.
|
107
|
+
pyegeria-1.5.1.0.23.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
108
|
+
pyegeria-1.5.1.0.23.dist-info/METADATA,sha256=XbpsIVNXd215mnvWA6JO43sYGsZIQGBHIm2EpvqAzsU,2998
|
109
|
+
pyegeria-1.5.1.0.23.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
110
|
+
pyegeria-1.5.1.0.23.dist-info/entry_points.txt,sha256=eQF0CAWVQlHftl85JzL0pWSaQ1eURJ6MeI1I78FvAgQ,4127
|
111
|
+
pyegeria-1.5.1.0.23.dist-info/RECORD,,
|
@@ -32,7 +32,6 @@ 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_glossary=commands.cat.list_glossary:main
|
36
35
|
list_gov_action_processes=commands.tech.list_gov_action_processes:main
|
37
36
|
list_gov_eng_status=commands.ops.monitor_gov_eng_status:main_paging
|
38
37
|
list_integ_daemon_status=commands.ops.monitor_integ_daemon_status:main_paging
|
@@ -45,11 +44,13 @@ list_relationship_types=commands.tech.list_relationship_types:main
|
|
45
44
|
list_relationships=commands.cat.list_relationships:main
|
46
45
|
list_tech_templates=commands.tech.list_tech_templates:main
|
47
46
|
list_tech_types=commands.cat.list_tech_types:main
|
47
|
+
list_terms=commands.cat.list_glossary:main
|
48
48
|
list_todos=commands.cat.list_todos:main
|
49
49
|
list_user_ids=commands.cat.list_user_ids:main
|
50
50
|
list_valid_metadata_values=commands.tech.list_valid_metadata_values:main
|
51
51
|
load_archive=commands.ops.load_archive:load_archive
|
52
52
|
load_archive_tui=commands.ops.load_archive:tui
|
53
|
+
load_terms_from_file=commands.cat.glossary_actions:load_terms
|
53
54
|
mark_todo_complete=commands.my.todo_actions:mark_todo_complete
|
54
55
|
monitor_asset_events=commands.ops.monitor_asset_events:main
|
55
56
|
monitor_coco_status=commands.ops.monitor_coco_status:main
|
File without changes
|
File without changes
|