pyegeria 0.7.17__py3-none-any.whl → 0.7.18__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.
@@ -52,6 +52,7 @@ from examples.widgets.tech.list_relationship_types import display_relationship_t
52
52
  from examples.widgets.tech.list_tech_templates import display_templates_spec
53
53
  from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
54
54
  from examples.widgets.tech.list_elements import list_elements
55
+ from examples.widgets.tech.get_element_info import display_elements
55
56
  from examples.widgets.tech.list_related_specification import display_related_specification
56
57
 
57
58
 
@@ -199,11 +200,20 @@ def show(ctx):
199
200
  pass
200
201
 
201
202
 
202
- @show.command("list-elements")
203
+ @show.command("get-elements")
203
204
  @click.pass_context
204
205
  @click.option('--om_type', default='Project', help='Metadata type to query')
205
206
  def get_element_info(ctx, om_type):
206
- """Display the valid metadata values for a property and type"""
207
+ """Display the elements for an Open Metadata Type"""
208
+ c = ctx.obj
209
+ display_elements(om_type, c.view_server, c.view_server_url,
210
+ c.userid, c.password, c.jupyter, c.width)
211
+
212
+ @show.command("list-elements")
213
+ @click.pass_context
214
+ @click.option('--om_type', default='Project', help='Metadata type to query')
215
+ def list_element_info(ctx, om_type):
216
+ """Display the elements for an Open Metadata Type"""
207
217
  c = ctx.obj
208
218
  list_elements(om_type, c.view_server, c.view_server_url,
209
219
  c.userid, c.password, c.jupyter, c.width)
@@ -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.get_element_info import display_elements
26
27
  from examples.widgets.tech.list_related_specification import display_related_specification
27
28
 
28
29
 
@@ -111,6 +112,16 @@ def show_guid_infos(ctx, guid):
111
112
  display_guid(guid, c.server, c.url,
112
113
  c.userid, c.password, c.jupyter, c.width)
113
114
 
115
+ @show.command('related-specifications')
116
+ @click.pass_context
117
+ @click.argument('element-guid')
118
+ def show_related_specifications(ctx, element_guid):
119
+ """List specifications related to the given Element"""
120
+ c = ctx.obj
121
+ display_related_specification(element_guid,c.view_server, c.view_server_url,
122
+ c.userid, c.password, c.jupyter, c.width)
123
+
124
+
114
125
 
115
126
  @show.command('tech-types')
116
127
  @click.option('--search-string', default='*', help='Tech type to search for')
@@ -211,20 +222,21 @@ def valid_metadata_values(ctx, property, type_name):
211
222
  @show.command('list-elements')
212
223
  @click.pass_context
213
224
  @click.option('--om_type', default='Organization', help='Metadata type to query')
214
- def get_element_info(ctx, om_type):
225
+ def list_element_info(ctx, om_type):
215
226
  """Display the valid metadata values for a property and type"""
216
227
  c = ctx.obj
217
228
  list_elements(om_type, c.view_server, c.view_server_url,
218
229
  c.userid, c.password, c.jupyter, c.width)
219
230
 
220
- @show.command('related-specifications')
231
+ @show.command("get-elements")
221
232
  @click.pass_context
222
- @click.argument('element-guid')
223
- def show_related_specifications(ctx, element_guid):
224
- """List specifications related to the given Element"""
233
+ @click.option('--om_type', default='Project', help='Metadata type to query')
234
+ def get_element_info(ctx, om_type):
235
+ """Display the elements for an Open Metadata Type"""
225
236
  c = ctx.obj
226
- display_related_specification(element_guid,c.view_server, c.view_server_url,
227
- c.userid, c.password, c.jupyter, c.width)
237
+ display_elements(om_type, c.view_server, c.view_server_url,
238
+ c.userid, c.password, c.jupyter, c.width)
239
+
228
240
 
229
241
  #
230
242
  # Tell
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-Lic
4
+ ense-Identifier: Apache-2.0
5
+ Copyright Contributors to the ODPi Egeria project.
6
+
7
+
8
+ A simple display of elements for an Open Metadata Type in tree form.
9
+ """
10
+ import argparse
11
+ import json
12
+ import os
13
+ import sys
14
+
15
+ from rich import print, box
16
+ from rich.console import Console
17
+ from rich.markdown import Markdown
18
+ from rich.panel import Panel
19
+
20
+ from rich.prompt import Prompt
21
+ from rich.text import Text
22
+ from rich.tree import Tree
23
+
24
+ from pyegeria import (
25
+ InvalidParameterException,
26
+ PropertyServerException,
27
+ UserNotAuthorizedException,
28
+ Client, ClassificationManager
29
+ )
30
+
31
+
32
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
33
+ EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
34
+ EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
35
+ EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
36
+ EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
37
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
38
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
39
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
40
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
41
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
42
+ EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
43
+ EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
44
+
45
+
46
+ def display_elements(om_type: str, server: str, url: str, username: str, user_password: str,
47
+ jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
48
+ ):
49
+ c = ClassificationManager(server, url, user_id=username, user_pwd=user_password)
50
+
51
+ bearer_token = c.create_egeria_bearer_token(username, user_password)
52
+
53
+ try:
54
+ console = Console(width=width, force_terminal=not jupyter, style="bold white on black")
55
+ r = c.get_elements(om_type)
56
+ if type(r) is not list:
57
+ print(f"\n\n\tno elements found: {r}")
58
+ sys.exit(1)
59
+
60
+ tree = Tree(f"Elements for Open Metadata Type:{om_type}\n* There are {len(r)} elements", style="bold bright_white on black",
61
+ guide_style="bold bright_blue")
62
+ t = tree.add(f"Elements for {om_type}", style="bold bright_white on black")
63
+ for element in r:
64
+ header = element['elementHeader']
65
+ el_type = header["type"]['typeName']
66
+ el_home = header['origin']['homeMetadataCollectionName']
67
+ el_create_time = header['versions']['createTime']
68
+ el_guid = header['guid']
69
+
70
+ el_md = (f"#### Element Basics\n"
71
+ f"* **Type**: {el_type}\n"
72
+ f"* **Home**: {el_home}\n"
73
+ f"* **Created**: {el_create_time}\n"
74
+ f"* **GUID**: {el_guid}\n ---\n")
75
+ for prop in element['properties'].keys():
76
+ el_md += f"* **{prop}**: {element['properties'][prop]}\n"
77
+
78
+ el_out = Markdown(el_md)
79
+ p = Panel.fit(el_out, title=element['properties']['qualifiedName'],
80
+ style = "bold white on black")
81
+ t = tree.add(p)
82
+
83
+ print(tree)
84
+
85
+ c.close_session()
86
+
87
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
88
+ if type(e) is str:
89
+ console.print_exception()
90
+ else:
91
+ # console.print_exception(show_locals=True)
92
+ console.print(f"\n ===> Looks like the type {om_type} isn't known...\n")
93
+
94
+
95
+
96
+ def main():
97
+ parser = argparse.ArgumentParser()
98
+ parser.add_argument("--server", help="Name of the server to display status for")
99
+ parser.add_argument("--url", help="URL Platform to connect to")
100
+ parser.add_argument("--userid", help="User Id")
101
+ parser.add_argument("--password", help="User Password")
102
+
103
+ # parser.add_argument("--sponsor", help="Name of sponsor to search")
104
+ args = parser.parse_args()
105
+
106
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
107
+ url = args.url if args.url is not None else EGERIA_VIEW_SERVER_URL
108
+ userid = args.userid if args.userid is not None else EGERIA_USER
109
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
110
+
111
+ try:
112
+ om_type = Prompt.ask("Enter the Open Metadata Type to find Elements for", default=None)
113
+ display_elements(om_type, server, url, userid, user_pass)
114
+ except (KeyboardInterrupt):
115
+ pass
116
+
117
+
118
+ if __name__ == "__main__":
119
+ main()
@@ -43,7 +43,7 @@ def display_related_specification(element_guid: str, server: str, url: str, user
43
43
  rel_el = c_client.get_related_elements(element_guid, 'SpecificationPropertyAssignment', None)
44
44
 
45
45
  if type(rel_el) is str:
46
- print(f"\n\nWas not able list related specifications for {element_guid}\n\n")
46
+ print(f"\n\nDid not find related specifications for {element_guid}\n\n")
47
47
  sys.exit(0)
48
48
 
49
49
  related_elements: dict = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.17
3
+ Version: 0.7.18
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -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=L8VdfZcI_2ccbOIiXNeaYWXgzvG7RwS3n5AzyXNxbOU,24440
18
+ examples/widgets/cli/egeria.py,sha256=suBsHL-d26AetuSOGdtGWByf6iit0Enom3zh2D41gVg,24870
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=tbFbJJFY6MpU6hbF9VSBLWOlaUbeUgesSFPi4wOF0_Y,9812
22
+ examples/widgets/cli/egeria_tech.py,sha256=AA2PNDKebdDObtrmjF6BHaSuSpNVeQgB61CSX1cBvsg,10255
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
@@ -46,12 +46,13 @@ examples/widgets/ops/refresh_integration_daemon.py,sha256=QDB3dpAlLY8PhrGhAZG4tW
46
46
  examples/widgets/ops/restart_integration_daemon.py,sha256=fID7qGFL5RD6rfn9PgXf5kwI4MU0Ho_IGXnDVbKT5nU,2710
47
47
  examples/widgets/tech/README.md,sha256=nxDnfr3BCiGgW5G1VxWxiwUWJXIe5wreNuUeRyIt_hY,1343
48
48
  examples/widgets/tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
+ examples/widgets/tech/get_element_info.py,sha256=3B6mTu09d-FRTVWbZ5uujKBLLy8ULFyr5F4ZYE0F65g,4582
49
50
  examples/widgets/tech/get_guid_info.py,sha256=p-peTX1Mahi8fNmcNVHOVI3OjqjlJwZjv7gRdBI4l0Q,4137
50
51
  examples/widgets/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18TBcQ-PU5kEAw,6023
51
52
  examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
52
53
  examples/widgets/tech/list_elements.py,sha256=xQg-PGS2oORed2ATVNPZvGVCGLEUHO5rOeXvgS6pkrg,4726
53
54
  examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
54
- examples/widgets/tech/list_related_specification.py,sha256=7omZFJPndec1zCL_reO1drvE6fHi4MQJu6PpAh9FNww,5802
55
+ examples/widgets/tech/list_related_specification.py,sha256=zFOsqR-GB4VUWnZoxmaKWv1-qkI3syRoIC9iIEO6khI,5797
55
56
  examples/widgets/tech/list_relationship_types.py,sha256=0T8Sl7J3WFq_0IQLLzcL0T79pUxVENWNT95Cpjz2ukc,5633
56
57
  examples/widgets/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
57
58
  examples/widgets/tech/list_valid_metadata_values.py,sha256=64z5tr-0VD-mPTFmr6FT76gj4MXJZLWTxT4oeIiUaiU,6043
@@ -82,8 +83,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
82
83
  pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
83
84
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
84
85
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
85
- pyegeria-0.7.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
86
- pyegeria-0.7.17.dist-info/METADATA,sha256=2cG8Oe7rsCNDuVRh7Kq1ckSHk0e5dFtC6mvTqchIQiI,2775
87
- pyegeria-0.7.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
88
- pyegeria-0.7.17.dist-info/entry_points.txt,sha256=hnXpc9IDhQuV3fR_Ann1Cbn-IvheeRI0Fc0tRQWNamg,3004
89
- pyegeria-0.7.17.dist-info/RECORD,,
86
+ pyegeria-0.7.18.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
87
+ pyegeria-0.7.18.dist-info/METADATA,sha256=XDMVQXjo6kQBCpwJyQbBDMIx5st3UvK_1BPxGcBF3ow,2775
88
+ pyegeria-0.7.18.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
89
+ pyegeria-0.7.18.dist-info/entry_points.txt,sha256=hnXpc9IDhQuV3fR_Ann1Cbn-IvheeRI0Fc0tRQWNamg,3004
90
+ pyegeria-0.7.18.dist-info/RECORD,,