pyegeria 0.7.15__py3-none-any.whl → 0.7.16__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.
- examples/widgets/cli/egeria.py +16 -1
- examples/widgets/cli/egeria_tech.py +11 -1
- examples/widgets/ops/engine_actions.py +1 -7
- examples/widgets/ops/list_catalog_targets.py +1 -1
- examples/widgets/tech/list_related_elements.py +145 -0
- {pyegeria-0.7.15.dist-info → pyegeria-0.7.16.dist-info}/METADATA +1 -1
- {pyegeria-0.7.15.dist-info → pyegeria-0.7.16.dist-info}/RECORD +10 -9
- {pyegeria-0.7.15.dist-info → pyegeria-0.7.16.dist-info}/entry_points.txt +1 -0
- {pyegeria-0.7.15.dist-info → pyegeria-0.7.16.dist-info}/LICENSE +0 -0
- {pyegeria-0.7.15.dist-info → pyegeria-0.7.16.dist-info}/WHEEL +0 -0
examples/widgets/cli/egeria.py
CHANGED
@@ -24,6 +24,7 @@ from examples.widgets.cat.list_projects import display_project_list
|
|
24
24
|
from examples.widgets.cat.list_tech_types import display_tech_types
|
25
25
|
from examples.widgets.cat.list_todos import display_to_dos
|
26
26
|
from examples.widgets.cli.ops_config import Config
|
27
|
+
from examples.widgets.cat.list_relationships import list_relationships
|
27
28
|
|
28
29
|
from examples.widgets.ops.engine_actions import start_server as start_engine_host, \
|
29
30
|
stop_server as stop_engine_host
|
@@ -51,7 +52,8 @@ from examples.widgets.tech.list_relationship_types import display_relationship_t
|
|
51
52
|
from examples.widgets.tech.list_tech_templates import display_templates_spec
|
52
53
|
from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
|
53
54
|
from examples.widgets.tech.list_elements import list_elements
|
54
|
-
from examples.widgets.
|
55
|
+
from examples.widgets.tech.list_related_elements import display_related_elements
|
56
|
+
|
55
57
|
|
56
58
|
@tui()
|
57
59
|
# @tui('menu', 'menu', 'A textual command line interface')
|
@@ -275,6 +277,19 @@ def show_registered_services(ctx, services):
|
|
275
277
|
display_registered_svcs(services, c.view_server, c.view_server_url,
|
276
278
|
c.userid, c.password, c.jupyter, c.width)
|
277
279
|
|
280
|
+
@show.command('related-elements')
|
281
|
+
@click.pass_context
|
282
|
+
@click.argument('element-guid')
|
283
|
+
@click.option('--rel-type',default = 'SpecificationPropertyAssignment',
|
284
|
+
help="Relationship type to find related elements of")
|
285
|
+
@click.option('--om_type', default = None, help="Optional Open Metadata Type to filter by.")
|
286
|
+
def show_related_elements(ctx, element_guid, rel_type, om_type):
|
287
|
+
c = ctx.obj
|
288
|
+
display_related_elements(element_guid,rel_type,om_type, c.view_server, c.view_server_url,
|
289
|
+
c.userid, c.password, c.jupyter, c.width)
|
290
|
+
|
291
|
+
|
292
|
+
|
278
293
|
|
279
294
|
@show.command('relationship-types')
|
280
295
|
@click.option('--rel-type', default='AssetOwner', help='Relationship type to get information about')
|
@@ -23,6 +23,7 @@ from examples.widgets.tech.list_tech_templates import display_templates_spec
|
|
23
23
|
from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
|
24
24
|
from examples.widgets.cat.get_tech_type_template import template_viewer
|
25
25
|
from examples.widgets.tech.list_elements import list_elements
|
26
|
+
from examples.widgets.tech.list_related_elements import display_related_elements
|
26
27
|
|
27
28
|
|
28
29
|
|
@@ -216,7 +217,16 @@ def get_element_info(ctx, om_type):
|
|
216
217
|
list_elements(om_type, c.view_server, c.view_server_url,
|
217
218
|
c.userid, c.password, c.jupyter, c.width)
|
218
219
|
|
219
|
-
|
220
|
+
@show.command('related-elements')
|
221
|
+
@click.pass_context
|
222
|
+
@click.argument('element-guid')
|
223
|
+
@click.option('--rel-type',default = 'SpecificationPropertyAssignment',
|
224
|
+
help="Relationship type to find related elements of")
|
225
|
+
@click.option('--om_type', default = None, help="Optional Open Metadata Type to filter by.")
|
226
|
+
def show_related_elements(ctx, element_guid, rel_type, om_type):
|
227
|
+
c = ctx.obj
|
228
|
+
display_related_elements(element_guid,rel_type,om_type, c.view_server, c.view_server_url,
|
229
|
+
c.userid, c.password, c.jupyter, c.width)
|
220
230
|
|
221
231
|
#
|
222
232
|
# Tell
|
@@ -4,15 +4,9 @@ Copyright Contributors to the ODPi Egeria project.
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
Execute engine actions.
|
8
8
|
|
9
9
|
"""
|
10
|
-
|
11
|
-
import os
|
12
|
-
from rich import print, print_json
|
13
|
-
from rich.console import Console
|
14
|
-
|
15
|
-
import time
|
16
10
|
import click
|
17
11
|
# from ops_config import Config, pass_config
|
18
12
|
from pyegeria import ServerOps, AutomatedCuration, INTEGRATION_GUIDS, Platform
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
List elements related to given element guid by the specified relationship type. Optionally filter by a specified
|
7
|
+
open metadata type.
|
8
|
+
|
9
|
+
"""
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
import sys
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
|
21
|
+
from pyegeria import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
UserNotAuthorizedException,
|
25
|
+
print_exception_response,
|
26
|
+
ClassificationManager
|
27
|
+
)
|
28
|
+
|
29
|
+
console = Console()
|
30
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
31
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
32
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
33
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
34
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
35
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
36
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
37
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
38
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
39
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
40
|
+
EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
|
41
|
+
EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
|
42
|
+
|
43
|
+
|
44
|
+
def display_related_elements(element_guid: str, relationship: str, om_type: str, server: str,
|
45
|
+
url: str, username: str, password: str, jupyter: bool = EGERIA_JUPYTER,
|
46
|
+
width: int = EGERIA_WIDTH
|
47
|
+
):
|
48
|
+
c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
|
49
|
+
token = c_client.create_egeria_bearer_token()
|
50
|
+
rel_el = c_client.get_related_elements(element_guid, relationship, om_type)
|
51
|
+
|
52
|
+
if type(rel_el) is str:
|
53
|
+
print(f"\n\nWas not able find related elements for {element_guid} with relationship {relationship}\n\n")
|
54
|
+
sys.exit(0)
|
55
|
+
|
56
|
+
def generate_table() -> Table:
|
57
|
+
"""Make a new table."""
|
58
|
+
table = Table(
|
59
|
+
title=f"Elements Related to guid: {element_guid} by relationship: {relationship} @ {time.asctime()}",
|
60
|
+
style="bold bright_white on black",
|
61
|
+
row_styles=["bold bright_white on black"],
|
62
|
+
header_style="white on dark_blue",
|
63
|
+
title_style="bold bright_white on black",
|
64
|
+
caption_style="white on black",
|
65
|
+
show_lines=True,
|
66
|
+
box=box.ROUNDED,
|
67
|
+
caption=f"Elements from Server '{server}' @ Platform - {url}",
|
68
|
+
expand=True,
|
69
|
+
# width=500
|
70
|
+
)
|
71
|
+
|
72
|
+
table.add_column("Relationship Properties")
|
73
|
+
table.add_column("Preferred Value")
|
74
|
+
table.add_column("Case Sensitive")
|
75
|
+
table.add_column("Description")
|
76
|
+
table.add_column("Additional Properties")
|
77
|
+
|
78
|
+
for related_element in rel_el:
|
79
|
+
relationship_props = related_element["relationshipProperties"]
|
80
|
+
|
81
|
+
rel_prop_md = ''
|
82
|
+
for key in relationship_props.keys():
|
83
|
+
rel_prop_md += f"{key}: {relationship_props[key]}\n"
|
84
|
+
# rel_prop_out = Markdown(rel_prop_md)
|
85
|
+
|
86
|
+
rel_element = related_element['relatedElement']
|
87
|
+
el = rel_element["properties"]
|
88
|
+
for prop in el:
|
89
|
+
el_case = el.get("isCaseSensitive", '---')
|
90
|
+
el_pref = el.get("preferredValue", '---')
|
91
|
+
el_desc = el.get("description", '---')
|
92
|
+
el_add = el.get("additionalProperties", '---')
|
93
|
+
|
94
|
+
el_add_md = ''
|
95
|
+
el_add_f = el_add.replace('\u003d',':')
|
96
|
+
s = el_add.strip('{}').strip()
|
97
|
+
pairs = [i.split('=') for i in s.split(', ')]
|
98
|
+
# d_add_prop = dict(pairs)
|
99
|
+
# for key in d_add_prop.keys():
|
100
|
+
# el_add_md += f"{key}: {d_add_prop[key]}\n"
|
101
|
+
# el_add_out = Markdown(el_add_md)
|
102
|
+
|
103
|
+
table.add_row(rel_prop_md, el_pref, el_case, el_desc, s)
|
104
|
+
|
105
|
+
return table
|
106
|
+
|
107
|
+
try:
|
108
|
+
console = Console(width=width, force_terminal=not jupyter)
|
109
|
+
|
110
|
+
with console.pager(styles=True):
|
111
|
+
console.print(generate_table())
|
112
|
+
|
113
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
114
|
+
print_exception_response(e)
|
115
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
116
|
+
finally:
|
117
|
+
c_client.close_session()
|
118
|
+
|
119
|
+
|
120
|
+
def main():
|
121
|
+
parser = argparse.ArgumentParser()
|
122
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
123
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
124
|
+
parser.add_argument("--userid", help="User Id")
|
125
|
+
parser.add_argument("--password", help="Password")
|
126
|
+
|
127
|
+
args = parser.parse_args()
|
128
|
+
|
129
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
130
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
131
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
132
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
133
|
+
guid = None
|
134
|
+
|
135
|
+
try:
|
136
|
+
element_guid = Prompt.ask("Enter an Element GUID find relationships for")
|
137
|
+
relationship = Prompt.ask("Enter the relationship to search", default="SpecificationPropertyAssignment")
|
138
|
+
om_type = Prompt.ask("Enter an optional Open Metadata Type", default=None)
|
139
|
+
display_related_elements(element_guid, relationship, om_type, server, url, userid, password)
|
140
|
+
except(KeyboardInterrupt):
|
141
|
+
pass
|
142
|
+
|
143
|
+
|
144
|
+
if __name__ == "__main__":
|
145
|
+
main()
|
@@ -15,11 +15,11 @@ examples/widgets/cat/list_relationships.py,sha256=lRfnsMUc0KN6Gb3qJoHjAwYGrcvTk3
|
|
15
15
|
examples/widgets/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
|
16
16
|
examples/widgets/cat/list_todos.py,sha256=wD9HevGcc4G_bxV25VUz1rRssdZHE33mF5zmJ6Lprt8,5522
|
17
17
|
examples/widgets/cli/__init__.py,sha256=6d_R0KZBNnJy9EBz9J2xvGFlx-3j_ZPqPCxKgdvYeDQ,291
|
18
|
-
examples/widgets/cli/egeria.py,sha256=
|
18
|
+
examples/widgets/cli/egeria.py,sha256=lCpnsdOjg6E8vQ2DbjxkXf9Mw5h-Y2b1g0RXnYo_eRw,24623
|
19
19
|
examples/widgets/cli/egeria_cat.py,sha256=q02DByikrGY6QHPy5u-R6zVBt6-y146iecmkA3oVb4A,10826
|
20
20
|
examples/widgets/cli/egeria_my.py,sha256=xi2j1hzNnjDruJeR1qa8K9JPDgzaL_COsMkcieT4Vo8,5653
|
21
21
|
examples/widgets/cli/egeria_ops.py,sha256=Y2fNDFnaaMjt8vjOeUXneh4_WEyxp0ucMvIfdLn8Bik,10139
|
22
|
-
examples/widgets/cli/egeria_tech.py,sha256=
|
22
|
+
examples/widgets/cli/egeria_tech.py,sha256=C16HE4d-hwcLOlSCl9QODx9PXzQ5nJu55o7lFm1ZoZk,9996
|
23
23
|
examples/widgets/cli/ops_config.py,sha256=m4AfPjf-fR4EBTx8Dc2mcgrfWwAxb30YGeV-v79bg4U,1450
|
24
24
|
examples/widgets/my/README.md,sha256=ZheFhj_VoPMhcWjW3pGchHB0vH_A9PklSmrSkzKdrcQ,844
|
25
25
|
examples/widgets/my/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -30,9 +30,9 @@ examples/widgets/my/monitor_open_todos.py,sha256=DIeWC-2tN1EtmgC2rWJfsGMVQhtNcng
|
|
30
30
|
examples/widgets/my/my_profile_actions.py,sha256=SrlC0PSix0b78MCWJdGJAVgai8gbJmYyz1ou2ZVOkIs,3949
|
31
31
|
examples/widgets/ops/README.md,sha256=PJsSDcvMv6E6og6y-cwvxFX5lhCII0UCwgKiM1T17MQ,1595
|
32
32
|
examples/widgets/ops/__init__.py,sha256=SCfzF3-aMx8EpqLWmH7JQf13gTmMAtHRbg69oseLvi8,480
|
33
|
-
examples/widgets/ops/engine_actions.py,sha256=
|
33
|
+
examples/widgets/ops/engine_actions.py,sha256=DsigDB_CNOwyRPgYxhLWjmgJV1_7hK8ip11T9gXsc0o,1332
|
34
34
|
examples/widgets/ops/integration_daemon_actions.py,sha256=m17Oi8NJfs1qPaV6qRadse3HhLQT16FQA0jAIUYuCTk,3951
|
35
|
-
examples/widgets/ops/list_catalog_targets.py,sha256=
|
35
|
+
examples/widgets/ops/list_catalog_targets.py,sha256=0FIZqZu7DSh7tnrme6EOhNiVvK8wyvN1iTZKEDuwTmw,6620
|
36
36
|
examples/widgets/ops/load_archive.py,sha256=duf3wq2ANRBiOj9KTFsw8TseEkJLKdzITAeTCjsMvI0,2453
|
37
37
|
examples/widgets/ops/monitor_asset_events.py,sha256=cjdlVqE0XYnoRW3aorNbsVkjByDXefPBnllaZLelGls,3838
|
38
38
|
examples/widgets/ops/monitor_coco_status.py,sha256=ERz3OJ0TXImNKHGD4gJvgT3pl2gS23ewAdUuYVLUhEE,3299
|
@@ -51,6 +51,7 @@ examples/widgets/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18
|
|
51
51
|
examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
|
52
52
|
examples/widgets/tech/list_elements.py,sha256=xQg-PGS2oORed2ATVNPZvGVCGLEUHO5rOeXvgS6pkrg,4726
|
53
53
|
examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
|
54
|
+
examples/widgets/tech/list_related_elements.py,sha256=hDiPThI9FLI63yoWEy7j7k_zLPBSlZIXYSaixiY_YAY,5785
|
54
55
|
examples/widgets/tech/list_relationship_types.py,sha256=0T8Sl7J3WFq_0IQLLzcL0T79pUxVENWNT95Cpjz2ukc,5633
|
55
56
|
examples/widgets/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
|
56
57
|
examples/widgets/tech/list_valid_metadata_values.py,sha256=64z5tr-0VD-mPTFmr6FT76gj4MXJZLWTxT4oeIiUaiU,6043
|
@@ -80,8 +81,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
|
|
80
81
|
pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
|
81
82
|
pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
|
82
83
|
pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
|
83
|
-
pyegeria-0.7.
|
84
|
-
pyegeria-0.7.
|
85
|
-
pyegeria-0.7.
|
86
|
-
pyegeria-0.7.
|
87
|
-
pyegeria-0.7.
|
84
|
+
pyegeria-0.7.16.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
85
|
+
pyegeria-0.7.16.dist-info/METADATA,sha256=UrNPrPJxm58XxX7OozELahmXQGwO1xv4mX9y2P47Oa4,2775
|
86
|
+
pyegeria-0.7.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
87
|
+
pyegeria-0.7.16.dist-info/entry_points.txt,sha256=zCihYOoewwczEFaj8HIjQjfppnFz79m--yUSA3_Sg3k,2994
|
88
|
+
pyegeria-0.7.16.dist-info/RECORD,,
|
@@ -24,6 +24,7 @@ list_integ_daemon_status=examples.widgets.ops.monitor_integ_daemon_status:main_p
|
|
24
24
|
list_my_profile=examples.widgets.my.list_my_profile:main
|
25
25
|
list_projects=examples.widgets.cat.list_projects:main
|
26
26
|
list_registered_services=examples.widgets.tech.list_registered_services:main
|
27
|
+
list_related_elements=examples.widgets.tech.list_related_elements:main
|
27
28
|
list_relationship_types=examples.widgets.tech.list_relationship_types:main
|
28
29
|
list_relationships=examples.widgets.cat.list_relationships:main
|
29
30
|
list_tech_templates=examples.widgets.tech.list_tech_templates:main
|
File without changes
|
File without changes
|