pyegeria 1.5.1.0.16__py3-none-any.whl → 1.5.1.0.17__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.
@@ -114,15 +114,6 @@ def list_deployed_database_schemas(
114
114
  continue
115
115
 
116
116
  el_name = element["properties"].get("name", "---")
117
- # el_type = header["type"]["typeName"]
118
- # el_home = header["origin"]["homeMetadataCollectionName"]
119
- # el_create_time = header["versions"]["createTime"][:-10]
120
- # el_created_by = header["versions"]["createdBy"]
121
- # el_created_md = (
122
- # f"* **Created By**: {el_created_by}\n"
123
- # f"* **Created Time**: {el_create_time}"
124
- # )
125
- # el_created_out = Markdown(el_created_md)
126
117
 
127
118
  el_guid = header["guid"]
128
119
 
@@ -148,9 +139,6 @@ def list_deployed_database_schemas(
148
139
 
149
140
  # get the schema properties
150
141
  el_props_md = make_prop_md(element["properties"])
151
- # el_props_md = ""
152
- # for prop in element["properties"].keys():
153
- # el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
154
142
 
155
143
  # Now get property facets related to us
156
144
  el_facets = c_client.get_related_elements(
@@ -189,7 +177,7 @@ def list_deployed_database_schemas(
189
177
  # spacer = "---\n"
190
178
  # elif count > len_els:
191
179
  # spacer = ""
192
- rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
180
+ # rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
193
181
  if count == len_els:
194
182
  rel_el_md = rel_el_md[:-4]
195
183
  rel_el_out = Markdown(rel_el_md)
commands/cli/egeria.py CHANGED
@@ -32,7 +32,7 @@ from commands.my.list_my_profile import display_my_profile
32
32
  from commands.my.list_my_roles import display_my_roles
33
33
  from commands.my.monitor_my_todos import display_my_todos
34
34
  from commands.my.monitor_open_todos import display_todos
35
- from commands.cat.old_list_deployed_database_schemas import (
35
+ from commands.cat.list_deployed_database_schemas import (
36
36
  list_deployed_database_schemas,
37
37
  )
38
38
  from commands.cat.list_deployed_catalogs import list_deployed_catalogs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 1.5.1.0.16
3
+ Version: 1.5.1.0.17
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -11,7 +11,7 @@ commands/cat/list_archives.py,sha256=FEZ2XYnQIWo2PztWqnj6unn0pbblPU0-bMbTyI3csv4
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
- commands/cat/list_deployed_database_schemas.py,sha256=cYT1tDObfcwo-fTYGiaGVqYnd9liPGvIvhmkPcmb4Q0,9463
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
16
  commands/cat/list_glossary.py,sha256=tUtQQoTGTlDLU-yFbfO3zjiJC9QyEJfg8NxnGCo2mnI,5811
17
17
  commands/cat/list_projects.py,sha256=Jzs-DtIpPhCH-gY4PYT6mnRBWnEf4m18TFfcw8UymNU,8011
@@ -19,9 +19,8 @@ commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468
19
19
  commands/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
20
20
  commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnUI79ir4,6542
21
21
  commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
22
- commands/cat/old_list_deployed_database_schemas.py,sha256=56n81Ks7g_g90begVVeqObQJxvnDjMRc1_ORJfkXbd4,7913
23
22
  commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
24
- commands/cli/egeria.py,sha256=HwEYm8TkRQ7b0kFG88Tl-_UI0Fm4U5Jq_s63xOBOHEc,31269
23
+ commands/cli/egeria.py,sha256=5ktUIbf5PIuHUQbcx_-HpI3Xolx38euvLT25AQhBWvE,31265
25
24
  commands/cli/egeria_cat.py,sha256=NwPCRTIjwQtna5vvjInT6L0krwp2c6k-Fm-oxN6qrnw,14800
26
25
  commands/cli/egeria_my.py,sha256=9zIpUDLeA_R-0rgCSQfEZTtVmkxPcEAsYcCTn1wQFrE,6181
27
26
  commands/cli/egeria_ops.py,sha256=fxDXYWXRhexx06PdSLCp2FhgUtS13NdDpyg7ea775fc,11531
@@ -102,8 +101,8 @@ pyegeria/server_operations.py,sha256=ciH890hYT85YQ6OpByn4w7s3a7TtvWZpIG5rkRqbcI0
102
101
  pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
103
102
  pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
104
103
  pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
105
- pyegeria-1.5.1.0.16.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
106
- pyegeria-1.5.1.0.16.dist-info/METADATA,sha256=XicdAKbnM5ynI5BxsOAM7z_cnN6WDeXa5_gaw6jb58g,2998
107
- pyegeria-1.5.1.0.16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
108
- pyegeria-1.5.1.0.16.dist-info/entry_points.txt,sha256=Pc5kHnxv-vbRpwVMxSSWl66vmf7EZjgzf7nZzz1ow3M,4002
109
- pyegeria-1.5.1.0.16.dist-info/RECORD,,
104
+ pyegeria-1.5.1.0.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
105
+ pyegeria-1.5.1.0.17.dist-info/METADATA,sha256=6WZLgNqYHODH9WPBw7Mu0qSlxvjvckzePfF6NoSDtbU,2998
106
+ pyegeria-1.5.1.0.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
107
+ pyegeria-1.5.1.0.17.dist-info/entry_points.txt,sha256=Pc5kHnxv-vbRpwVMxSSWl66vmf7EZjgzf7nZzz1ow3M,4002
108
+ pyegeria-1.5.1.0.17.dist-info/RECORD,,
@@ -1,218 +0,0 @@
1
- """This creates a templates guid file from the core metadata archive"""
2
- from rich.markdown import Markdown
3
- from rich.prompt import Prompt
4
- import os
5
- import argparse
6
- import time
7
- import sys
8
- from rich import box
9
- from rich.console import Console
10
- from rich.table import Table
11
-
12
- from pyegeria import (
13
- InvalidParameterException,
14
- PropertyServerException,
15
- UserNotAuthorizedException,
16
- print_exception_response,
17
- EgeriaTech,
18
- )
19
-
20
-
21
- console = Console()
22
- EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
23
- EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
24
- EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
25
- EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
26
- EGERIA_VIEW_SERVER_URL = os.environ.get(
27
- "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
28
- )
29
- EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
30
- EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
31
- EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
32
- EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
33
- EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
34
- EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
35
- EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
36
-
37
-
38
- def check_if_template(header: dict) -> bool:
39
- """Check if the the template classification is set"""
40
- classifications = header.get("classifications", None)
41
- if classifications is None:
42
- return False
43
- for c in classifications:
44
- if c["type"]["typeName"] == "Template":
45
- return True
46
- return False
47
-
48
-
49
- def list_deployed_database_schemas(
50
- db_name: str,
51
- server: str,
52
- url: str,
53
- username: str,
54
- password: str,
55
- jupyter: bool = EGERIA_JUPYTER,
56
- width: int = EGERIA_WIDTH,
57
- ):
58
- c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
59
- token = c_client.create_egeria_bearer_token()
60
-
61
- def generate_table() -> Table:
62
- """Make a new table."""
63
- table = Table(
64
- caption=f"Databases found: {url} - {server} @ {time.asctime()}",
65
- style="bold bright_white on black",
66
- row_styles=["bold bright_white on black"],
67
- header_style="white on dark_blue",
68
- title_style="bold bright_white on black",
69
- caption_style="white on black",
70
- show_lines=True,
71
- box=box.ROUNDED,
72
- # title=f"Elements for Open Metadata Type: '{om_type}' ",
73
- expand=True,
74
- # width=500
75
- )
76
-
77
- table.add_column("Schema in Catalog")
78
- table.add_column("Schema Properties")
79
-
80
- table.add_column("Cataloged Resource")
81
-
82
- om_type = "DeployedDatabaseSchema"
83
-
84
- # get the guid for the database or catalog
85
-
86
- if db_name in (None, "*"):
87
- dbs = c_client.get_elements(om_type)
88
- else:
89
- db_guid = c_client.get_guid_for_name(db_name)
90
- dbs = c_client.get_elements_by_classification_with_property_value(
91
- "Anchors", db_guid, ["anchorGUID"], om_type
92
- )
93
-
94
- if type(dbs) is not list:
95
- print("No instances found")
96
- sys.exit(1)
97
-
98
- for element in dbs:
99
- header = element["elementHeader"]
100
-
101
- if check_if_template(header):
102
- continue
103
-
104
- el_name = element["properties"].get("name", "---")
105
- el_type = header["type"]["typeName"]
106
- el_home = header["origin"]["homeMetadataCollectionName"]
107
- el_create_time = header["versions"]["createTime"][:-10]
108
- el_created_by = header["versions"]["createdBy"]
109
- el_created_md = (
110
- f"* **Created By**: {el_created_by}\n"
111
- f"* **Created Time**: {el_create_time}"
112
- )
113
- el_created_out = Markdown(el_created_md)
114
-
115
- el_guid = header["guid"]
116
-
117
- el_classification = header["classifications"]
118
- for c in el_classification:
119
- if c["type"]["typeName"] == "Anchors":
120
- el_anchor_guid = c["classificationProperties"]["anchorGUID"]
121
- el_anchor_type_name = c["classificationProperties"][
122
- "anchorTypeName"
123
- ]
124
- if el_anchor_type_name == "Catalog":
125
- el_cat = c_client.get_element_by_guid(el_anchor_guid)
126
- el_cat_name = el_cat["properties"].get("name", None)
127
- if el_cat_name is None:
128
- el_cat_name = el_cat["properties"].get(
129
- "qualifiedName", "---"
130
- )
131
- el_cat_guid = el_cat["elementHeader"]["guid"]
132
- el_schema_id = (
133
- f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
134
- )
135
- el_props_md = ""
136
- for prop in element["properties"].keys():
137
- el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
138
- el_props_out = Markdown(el_props_md)
139
-
140
- rel_elements = c_client.get_elements_by_property_value(
141
- el_guid, ["anchorGUID"]
142
- )
143
- schema_md = ""
144
- count = 0
145
- rel_el_out = ""
146
- if type(rel_elements) is list:
147
- len_els = len(rel_elements)
148
- rel_el_md = ""
149
- spacer = "---\n"
150
- for rel_element in rel_elements:
151
- count += 1
152
- rel_type = rel_element["elementHeader"]["type"]["typeName"]
153
- rel_guid = rel_element["elementHeader"]["guid"]
154
- rel_props = rel_element["properties"]
155
- props_md = ""
156
- for key in rel_props.keys():
157
- props_md += f"\t* **{key}**: {rel_props[key]}\n"
158
- rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
159
-
160
- # rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
161
- if count == len_els:
162
- rel_el_md = rel_el_md[:-4]
163
- rel_el_out = Markdown(rel_el_md)
164
-
165
- table.add_row(
166
- el_schema_id,
167
- # el_type,
168
- # el_created_out,
169
- # el_home,
170
- # el_guid,
171
- el_props_out,
172
- rel_el_out,
173
- )
174
-
175
- return table
176
-
177
- try:
178
- console = Console(width=width, force_terminal=not jupyter)
179
-
180
- with console.pager(styles=True):
181
- console.print(generate_table())
182
-
183
- except (
184
- InvalidParameterException,
185
- PropertyServerException,
186
- UserNotAuthorizedException,
187
- ) as e:
188
- print_exception_response(e)
189
- print("\n\nPerhaps the type name isn't known")
190
- finally:
191
- c_client.close_session()
192
-
193
-
194
- def main():
195
- parser = argparse.ArgumentParser()
196
- parser.add_argument("--server", help="Name of the server to display status for")
197
- parser.add_argument("--url", help="URL Platform to connect to")
198
- parser.add_argument("--userid", help="User Id")
199
- parser.add_argument("--password", help="Password")
200
-
201
- args = parser.parse_args()
202
-
203
- server = args.server if args.server is not None else EGERIA_VIEW_SERVER
204
- url = args.url if args.url is not None else EGERIA_PLATFORM_URL
205
- userid = args.userid if args.userid is not None else EGERIA_USER
206
- password = args.password if args.password is not None else EGERIA_USER_PASSWORD
207
-
208
- try:
209
- db_name = Prompt.ask(
210
- "Enter the name of a database/catalog to retrieve schemas for", default="*"
211
- )
212
- list_deployed_database_schemas(db_name, server, url, userid, password)
213
- except KeyboardInterrupt:
214
- pass
215
-
216
-
217
- if __name__ == "__main__":
218
- main()