pyegeria 1.5.1__py3-none-any.whl → 1.5.1.0.2__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/list_deployed_database_schemas.py +197 -0
- commands/cat/list_deployed_databases.py +185 -0
- commands/tech/get_element_graph.py +202 -0
- pyegeria/classification_manager_omvs.py +1 -1
- {pyegeria-1.5.1.dist-info → pyegeria-1.5.1.0.2.dist-info}/METADATA +1 -1
- {pyegeria-1.5.1.dist-info → pyegeria-1.5.1.0.2.dist-info}/RECORD +9 -6
- {pyegeria-1.5.1.dist-info → pyegeria-1.5.1.0.2.dist-info}/entry_points.txt +2 -1
- {pyegeria-1.5.1.dist-info → pyegeria-1.5.1.0.2.dist-info}/LICENSE +0 -0
- {pyegeria-1.5.1.dist-info → pyegeria-1.5.1.0.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,197 @@
|
|
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("Name")
|
78
|
+
table.add_column("Type")
|
79
|
+
table.add_column("Created", width=23)
|
80
|
+
table.add_column("Home Store")
|
81
|
+
table.add_column("GUID", width=38, no_wrap=True)
|
82
|
+
table.add_column("Properties")
|
83
|
+
table.add_column("Tables")
|
84
|
+
|
85
|
+
om_type = "DeployedDatabaseSchema"
|
86
|
+
if db_name in (None, "*"):
|
87
|
+
dbs = c_client.get_elements(om_type)
|
88
|
+
else:
|
89
|
+
dbs = c_client.get_elements_by_property_value(db_name, "name", om_type)
|
90
|
+
|
91
|
+
if type(dbs) is list:
|
92
|
+
for element in dbs:
|
93
|
+
header = element["elementHeader"]
|
94
|
+
|
95
|
+
if check_if_template(header):
|
96
|
+
continue
|
97
|
+
|
98
|
+
el_name = element["properties"].get("name", "---")
|
99
|
+
el_type = header["type"]["typeName"]
|
100
|
+
el_home = header["origin"]["homeMetadataCollectionName"]
|
101
|
+
el_create_time = header["versions"]["createTime"][:-10]
|
102
|
+
el_created_by = header["versions"]["createdBy"]
|
103
|
+
el_created_md = (
|
104
|
+
f"* **Created By**: {el_created_by}\n"
|
105
|
+
f"* **Created Time**: {el_create_time}"
|
106
|
+
)
|
107
|
+
el_created_out = Markdown(el_created_md)
|
108
|
+
|
109
|
+
el_guid = header["guid"]
|
110
|
+
|
111
|
+
el_props_md = ""
|
112
|
+
for prop in element["properties"].keys():
|
113
|
+
el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
|
114
|
+
el_props_out = Markdown(el_props_md)
|
115
|
+
|
116
|
+
rel_elements = c_client.get_related_elements(
|
117
|
+
el_guid, "RelationalDBSchemaType"
|
118
|
+
)
|
119
|
+
schema_md = ""
|
120
|
+
count = 0
|
121
|
+
rel_el_out = ""
|
122
|
+
if type(rel_elements) is list:
|
123
|
+
print(len(rel_elements))
|
124
|
+
for rel_element in rel_elements:
|
125
|
+
count += 1
|
126
|
+
rel_type = rel_element["relatedElement"]["elementHeader"][
|
127
|
+
"type"
|
128
|
+
]["typeName"]
|
129
|
+
rel_guid = rel_element["relatedElement"]["elementHeader"][
|
130
|
+
"guid"
|
131
|
+
]
|
132
|
+
rel_props = rel_element["relatedElement"]["properties"]
|
133
|
+
props_md = ""
|
134
|
+
for key in rel_props.keys():
|
135
|
+
props_md += f"* **{key}**: {rel_props[key]}\n"
|
136
|
+
rel_el_md = f"* **{rel_type}**: {rel_guid}\n{props_md}"
|
137
|
+
if count > 1:
|
138
|
+
rel_el_md += "---\n"
|
139
|
+
rel_el_out = Markdown(rel_el_md)
|
140
|
+
|
141
|
+
table.add_row(
|
142
|
+
el_name,
|
143
|
+
el_type,
|
144
|
+
el_created_out,
|
145
|
+
el_home,
|
146
|
+
el_guid,
|
147
|
+
el_props_out,
|
148
|
+
rel_el_out,
|
149
|
+
)
|
150
|
+
|
151
|
+
return table
|
152
|
+
else:
|
153
|
+
print("No instances found")
|
154
|
+
sys.exit(1)
|
155
|
+
|
156
|
+
try:
|
157
|
+
console = Console(width=width, force_terminal=not jupyter)
|
158
|
+
|
159
|
+
with console.pager(styles=True):
|
160
|
+
console.print(generate_table())
|
161
|
+
|
162
|
+
except (
|
163
|
+
InvalidParameterException,
|
164
|
+
PropertyServerException,
|
165
|
+
UserNotAuthorizedException,
|
166
|
+
) as e:
|
167
|
+
print_exception_response(e)
|
168
|
+
print("\n\nPerhaps the type name isn't known")
|
169
|
+
finally:
|
170
|
+
c_client.close_session()
|
171
|
+
|
172
|
+
|
173
|
+
def main():
|
174
|
+
parser = argparse.ArgumentParser()
|
175
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
176
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
177
|
+
parser.add_argument("--userid", help="User Id")
|
178
|
+
parser.add_argument("--password", help="Password")
|
179
|
+
|
180
|
+
args = parser.parse_args()
|
181
|
+
|
182
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
183
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
184
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
185
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
186
|
+
|
187
|
+
try:
|
188
|
+
db_name = Prompt.ask(
|
189
|
+
"Enter the name of a database to retrieve schemas for", default="*"
|
190
|
+
)
|
191
|
+
list_deployed_database_schemas(db_name, server, url, userid, password)
|
192
|
+
except KeyboardInterrupt:
|
193
|
+
pass
|
194
|
+
|
195
|
+
|
196
|
+
if __name__ == "__main__":
|
197
|
+
main()
|
@@ -0,0 +1,185 @@
|
|
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_databases(
|
50
|
+
server: str,
|
51
|
+
url: str,
|
52
|
+
username: str,
|
53
|
+
password: str,
|
54
|
+
jupyter: bool = EGERIA_JUPYTER,
|
55
|
+
width: int = EGERIA_WIDTH,
|
56
|
+
):
|
57
|
+
c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
|
58
|
+
token = c_client.create_egeria_bearer_token()
|
59
|
+
|
60
|
+
def generate_table() -> Table:
|
61
|
+
"""Make a new table."""
|
62
|
+
table = Table(
|
63
|
+
caption=f"Databases found: {url} - {server} @ {time.asctime()}",
|
64
|
+
style="bold bright_white on black",
|
65
|
+
row_styles=["bold bright_white on black"],
|
66
|
+
header_style="white on dark_blue",
|
67
|
+
title_style="bold bright_white on black",
|
68
|
+
caption_style="white on black",
|
69
|
+
show_lines=True,
|
70
|
+
box=box.ROUNDED,
|
71
|
+
# title=f"Elements for Open Metadata Type: '{om_type}' ",
|
72
|
+
expand=True,
|
73
|
+
# width=500
|
74
|
+
)
|
75
|
+
|
76
|
+
table.add_column("Qualified Name")
|
77
|
+
table.add_column("Type")
|
78
|
+
table.add_column("Created", width=23)
|
79
|
+
table.add_column("Home Store")
|
80
|
+
table.add_column("GUID", width=38, no_wrap=True)
|
81
|
+
table.add_column("Properties")
|
82
|
+
table.add_column("Schemas")
|
83
|
+
|
84
|
+
om_type = "Database"
|
85
|
+
dbs = c_client.get_elements(om_type)
|
86
|
+
if type(dbs) is list:
|
87
|
+
for element in dbs:
|
88
|
+
header = element["elementHeader"]
|
89
|
+
|
90
|
+
if check_if_template(header):
|
91
|
+
continue
|
92
|
+
|
93
|
+
el_q_name = element["properties"].get("qualifiedName", "---")
|
94
|
+
el_type = header["type"]["typeName"]
|
95
|
+
el_home = header["origin"]["homeMetadataCollectionName"]
|
96
|
+
el_create_time = header["versions"]["createTime"][:-10]
|
97
|
+
el_created_by = header["versions"]["createdBy"]
|
98
|
+
el_created_md = (
|
99
|
+
f"* **Created By**: {el_created_by}\n"
|
100
|
+
f"* **Created Time**: {el_create_time}"
|
101
|
+
)
|
102
|
+
el_created_out = Markdown(el_created_md)
|
103
|
+
|
104
|
+
el_guid = header["guid"]
|
105
|
+
|
106
|
+
el_props_md = ""
|
107
|
+
for prop in element["properties"].keys():
|
108
|
+
el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
|
109
|
+
el_props_out = Markdown(el_props_md)
|
110
|
+
|
111
|
+
rel_elements = c_client.get_related_elements(el_guid)
|
112
|
+
schema_md = ""
|
113
|
+
count = 0
|
114
|
+
if type(rel_elements) is list:
|
115
|
+
for rel_element in rel_elements:
|
116
|
+
count += 1
|
117
|
+
rel_type = rel_element["relatedElement"]["elementHeader"][
|
118
|
+
"type"
|
119
|
+
]["typeName"]
|
120
|
+
rel_guid = rel_element["relatedElement"]["elementHeader"][
|
121
|
+
"guid"
|
122
|
+
]
|
123
|
+
rel_props = rel_element["relatedElement"]["properties"]
|
124
|
+
props_md = ""
|
125
|
+
for key in rel_props.keys():
|
126
|
+
props_md += f"* **{key}**: {rel_props[key]}\n"
|
127
|
+
rel_el_md = f"* **{rel_type}**: {rel_guid}\n{props_md}"
|
128
|
+
if count > 1:
|
129
|
+
rel_el_md += "---\n"
|
130
|
+
rel_el_out = Markdown(rel_el_md)
|
131
|
+
|
132
|
+
table.add_row(
|
133
|
+
el_q_name,
|
134
|
+
el_type,
|
135
|
+
el_created_out,
|
136
|
+
el_home,
|
137
|
+
el_guid,
|
138
|
+
el_props_out,
|
139
|
+
rel_el_out,
|
140
|
+
)
|
141
|
+
|
142
|
+
return table
|
143
|
+
else:
|
144
|
+
print("No instances found")
|
145
|
+
sys.exit(1)
|
146
|
+
|
147
|
+
try:
|
148
|
+
console = Console(width=width, force_terminal=not jupyter)
|
149
|
+
|
150
|
+
with console.pager(styles=True):
|
151
|
+
console.print(generate_table())
|
152
|
+
|
153
|
+
except (
|
154
|
+
InvalidParameterException,
|
155
|
+
PropertyServerException,
|
156
|
+
UserNotAuthorizedException,
|
157
|
+
) as e:
|
158
|
+
print_exception_response(e)
|
159
|
+
print("\n\nPerhaps the type name isn't known")
|
160
|
+
finally:
|
161
|
+
c_client.close_session()
|
162
|
+
|
163
|
+
|
164
|
+
def main():
|
165
|
+
parser = argparse.ArgumentParser()
|
166
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
167
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
168
|
+
parser.add_argument("--userid", help="User Id")
|
169
|
+
parser.add_argument("--password", help="Password")
|
170
|
+
|
171
|
+
args = parser.parse_args()
|
172
|
+
|
173
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
174
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
175
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
176
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
177
|
+
|
178
|
+
try:
|
179
|
+
list_deployed_databases(server, url, userid, password)
|
180
|
+
except KeyboardInterrupt:
|
181
|
+
pass
|
182
|
+
|
183
|
+
|
184
|
+
if __name__ == "__main__":
|
185
|
+
main()
|
@@ -0,0 +1,202 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple display for glossary terms
|
10
|
+
"""
|
11
|
+
import argparse
|
12
|
+
import os
|
13
|
+
import sys
|
14
|
+
import time
|
15
|
+
|
16
|
+
from rich import box
|
17
|
+
from rich.console import Console
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.markdown import Markdown
|
20
|
+
from rich.table import Table
|
21
|
+
|
22
|
+
from pyegeria import (
|
23
|
+
InvalidParameterException,
|
24
|
+
PropertyServerException,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
print_exception_response,
|
27
|
+
EgeriaTech,
|
28
|
+
)
|
29
|
+
|
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(
|
35
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
36
|
+
)
|
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", "260"))
|
44
|
+
|
45
|
+
|
46
|
+
disable_ssl_warnings = True
|
47
|
+
|
48
|
+
|
49
|
+
def display_elements(
|
50
|
+
search_string: str,
|
51
|
+
prop_list: [str],
|
52
|
+
server: str,
|
53
|
+
url: str,
|
54
|
+
username: str,
|
55
|
+
user_password: str,
|
56
|
+
time_out: int = 60,
|
57
|
+
jupyter: bool = EGERIA_JUPYTER,
|
58
|
+
width: int = EGERIA_WIDTH,
|
59
|
+
):
|
60
|
+
console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
|
61
|
+
if (search_string is None) or (len(search_string) < 3):
|
62
|
+
raise ValueError(
|
63
|
+
"Invalid Search String - must be greater than four characters long"
|
64
|
+
)
|
65
|
+
g_client = EgeriaTech(server, url, username, user_password)
|
66
|
+
token = g_client.create_egeria_bearer_token()
|
67
|
+
|
68
|
+
def generate_table(search_string: str, prop_list: [str]) -> Table:
|
69
|
+
"""Make a new table."""
|
70
|
+
table = Table(
|
71
|
+
title=f"Assets containing the string {search_string} @ {time.asctime()}",
|
72
|
+
header_style="white on dark_blue",
|
73
|
+
style="bold white on black",
|
74
|
+
row_styles=["bold white on black"],
|
75
|
+
title_style="bold white on black",
|
76
|
+
caption_style="white on black",
|
77
|
+
show_lines=True,
|
78
|
+
box=box.ROUNDED,
|
79
|
+
caption=f"View Server '{server}' @ Platform - {url}",
|
80
|
+
expand=True,
|
81
|
+
)
|
82
|
+
# table.add_column("Qualified Name")
|
83
|
+
table.add_column("GUID", no_wrap=True)
|
84
|
+
table.add_column("Properties")
|
85
|
+
|
86
|
+
table.add_column("Classification Props", width=30)
|
87
|
+
table.add_column("Matching Elements")
|
88
|
+
|
89
|
+
classification = "Anchors"
|
90
|
+
open_type_name = None
|
91
|
+
property_value = search_string
|
92
|
+
property_names = prop_list
|
93
|
+
|
94
|
+
elements = g_client.find_elements_by_classification_with_property_value(
|
95
|
+
classification, property_value, property_names, open_type_name
|
96
|
+
)
|
97
|
+
if type(elements) is str:
|
98
|
+
return table
|
99
|
+
|
100
|
+
for element in elements:
|
101
|
+
template = False
|
102
|
+
guid = element["elementHeader"].get("guid", "---")
|
103
|
+
classifications = element["elementHeader"]["classifications"]
|
104
|
+
|
105
|
+
class_prop_md = ""
|
106
|
+
for classific in classifications:
|
107
|
+
class_prop = classific.get("classificationProperties", "---")
|
108
|
+
if type(class_prop) is dict:
|
109
|
+
for key in class_prop.keys():
|
110
|
+
class_prop_md += f"* {key}: {class_prop[key]}\n"
|
111
|
+
|
112
|
+
class_prop_out = Markdown(class_prop_md)
|
113
|
+
|
114
|
+
properties = element["properties"]
|
115
|
+
props_md = ""
|
116
|
+
if type(properties) is dict:
|
117
|
+
for key in properties.keys():
|
118
|
+
props_md += f"* {key}: {properties[key]}\n"
|
119
|
+
if key == "category" and properties[key] == "placeholderProperty":
|
120
|
+
template = True
|
121
|
+
props_out = Markdown(props_md)
|
122
|
+
|
123
|
+
if template: # Not interested in template elements in this method
|
124
|
+
continue
|
125
|
+
|
126
|
+
relationship = g_client.get_related_elements(guid, None, None)
|
127
|
+
|
128
|
+
if type(relationship) is list:
|
129
|
+
rel_md = ""
|
130
|
+
for rel in relationship:
|
131
|
+
match_tab = Table(expand=True)
|
132
|
+
match_tab.add_column("Type Name")
|
133
|
+
match_tab.add_column("GUID", no_wrap=True, width=36)
|
134
|
+
match_tab.add_column("Properties")
|
135
|
+
match = rel["relationshipHeader"]
|
136
|
+
match_type_name = match["type"]["typeName"]
|
137
|
+
matching_guid = match["guid"]
|
138
|
+
match_props = rel["relatedElement"]["properties"]
|
139
|
+
match_details_md = ""
|
140
|
+
for key in match_props.keys():
|
141
|
+
match_details_md += f"* {key}: {match_props[key]}\n"
|
142
|
+
match_details_out = Markdown(match_details_md)
|
143
|
+
match_tab.add_row(match_type_name, matching_guid, match_details_out)
|
144
|
+
|
145
|
+
table.add_row(guid, props_out, class_prop_out, match_tab)
|
146
|
+
|
147
|
+
g_client.close_session()
|
148
|
+
return table
|
149
|
+
|
150
|
+
try:
|
151
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
152
|
+
# while True:
|
153
|
+
# time.sleep(2)
|
154
|
+
# live.update(generate_table())
|
155
|
+
|
156
|
+
with console.pager(styles=True):
|
157
|
+
console.print(generate_table(search_string, prop_list), soft_wrap=True)
|
158
|
+
|
159
|
+
except (
|
160
|
+
InvalidParameterException,
|
161
|
+
PropertyServerException,
|
162
|
+
UserNotAuthorizedException,
|
163
|
+
) as e:
|
164
|
+
console.print_exception()
|
165
|
+
sys.exit(1)
|
166
|
+
|
167
|
+
except ValueError as e:
|
168
|
+
console.print(
|
169
|
+
f"\n\n====> Invalid Search String - must be greater than four characters long"
|
170
|
+
)
|
171
|
+
sys.exit(1)
|
172
|
+
|
173
|
+
|
174
|
+
def main():
|
175
|
+
parser = argparse.ArgumentParser()
|
176
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
177
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
178
|
+
parser.add_argument("--userid", help="User Id")
|
179
|
+
parser.add_argument("--password", help="User Password")
|
180
|
+
parser.add_argument("--time_out", help="Time Out")
|
181
|
+
|
182
|
+
args = parser.parse_args()
|
183
|
+
|
184
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
185
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
186
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
187
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
188
|
+
time_out = args.time_out if args.time_out is not None else 60
|
189
|
+
try:
|
190
|
+
search_string = Prompt.ask("Enter an asset search string:", default="")
|
191
|
+
prop_list = Prompt.ask(
|
192
|
+
"Enter the list of properties to search", default="anchorTypeName"
|
193
|
+
)
|
194
|
+
display_elements(
|
195
|
+
search_string, [prop_list], server, url, userid, user_pass, time_out
|
196
|
+
)
|
197
|
+
except KeyboardInterrupt:
|
198
|
+
pass
|
199
|
+
|
200
|
+
|
201
|
+
if __name__ == "__main__":
|
202
|
+
main()
|
@@ -9,6 +9,8 @@ commands/cat/get_tech_type_template.py,sha256=gMFVcgCIm09GQu1Vsc5ZUVH9XLhItAG1eV
|
|
9
9
|
commands/cat/list_archives.py,sha256=83LhNeZWhzRiE-oU6veuIk9ob4XDtDWUoXdGGXaYeE8,5454
|
10
10
|
commands/cat/list_assets.py,sha256=bNwSaBDz661hfnc2Rn4j4HPHAugKvz0XwN9L1m4FVQk,6529
|
11
11
|
commands/cat/list_cert_types.py,sha256=mbCls_EqC5JKG5rvS4o69k7KgZ6aNXlcqoJ3DtHsTFA,7127
|
12
|
+
commands/cat/list_deployed_database_schemas.py,sha256=5EYNOQgODr13sUJjvh-NESMOOlEWf8-86MXJf0KGkjI,7034
|
13
|
+
commands/cat/list_deployed_databases.py,sha256=O0-1__4w17vGvERxDO5DMI4u-PW_30iH0A2nrUejaus,6604
|
12
14
|
commands/cat/list_glossary.py,sha256=tUtQQoTGTlDLU-yFbfO3zjiJC9QyEJfg8NxnGCo2mnI,5811
|
13
15
|
commands/cat/list_projects.py,sha256=Jzs-DtIpPhCH-gY4PYT6mnRBWnEf4m18TFfcw8UymNU,8011
|
14
16
|
commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468GYw3Q,5869
|
@@ -49,6 +51,7 @@ commands/ops/refresh_integration_daemon.py,sha256=9dZX-AHJ7yILohj005TRIC9tC349RR
|
|
49
51
|
commands/ops/restart_integration_daemon.py,sha256=PN48zVDywjNJznmpVWEcBXBD3xhWDw1dMyKLIs9nWzU,2992
|
50
52
|
commands/tech/README.md,sha256=nxDnfr3BCiGgW5G1VxWxiwUWJXIe5wreNuUeRyIt_hY,1343
|
51
53
|
commands/tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
|
+
commands/tech/get_element_graph.py,sha256=YhpvHPNuSd-Ft-dBRLswGfqGYv2AlByyV0IyjhV4SSk,7367
|
52
55
|
commands/tech/get_element_info.py,sha256=Rauespy7ZfyKtLh_H8XWgYTpPijsqlUGm-zeb7KrG7k,4749
|
53
56
|
commands/tech/get_guid_info.py,sha256=HfwcGAFALFIpy4AJAgQHU__Fv1fjprh1G1xB5AjlZ80,4282
|
54
57
|
commands/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18TBcQ-PU5kEAw,6023
|
@@ -72,7 +75,7 @@ pyegeria/_globals.py,sha256=1Uc8392wjbiVN5L__RzxC1-U97RMXj77_iUsMSgeAjQ,638
|
|
72
75
|
pyegeria/_validators.py,sha256=rnZelHJnjHaLZ8UhUTDyB59MfIUJifhALtkYoHBaos4,12736
|
73
76
|
pyegeria/asset_catalog_omvs.py,sha256=fffZsSukOrG-xszD6uEPf2IX4p0IK63T0_w7_6BpG1Q,21075
|
74
77
|
pyegeria/automated_curation_omvs.py,sha256=Qt1qEsi9_UwS5ukpRhbnPiVwRqmrIVITbD-SBgOiw98,133227
|
75
|
-
pyegeria/classification_manager_omvs.py,sha256=
|
78
|
+
pyegeria/classification_manager_omvs.py,sha256=puJK1gOaD629_v1YI2lQgQoXjaLsm0JyYDKqUyL67zE,180814
|
76
79
|
pyegeria/collection_manager_omvs.py,sha256=kye2kjthNnmwxMZhHQKV0xoHbxcNPWjNzRAYOItj_gY,99201
|
77
80
|
pyegeria/core_omag_server_config.py,sha256=EtHaPKyc9d6pwTgbnQqGwe5lSBMPIfJOlbJEa1zg1JA,94946
|
78
81
|
pyegeria/create_tech_guid_lists.py,sha256=HHkC6HW58EN1BiolrYSRqSE0JhPbTepOFzwtdwBxVaU,4640
|
@@ -96,8 +99,8 @@ pyegeria/tech_guids_26-09-2024 09:30.py,sha256=7CTmbbNQ7qfJtWNbBhSiS6yIhs17SmWxK
|
|
96
99
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
97
100
|
pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
|
98
101
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
99
|
-
pyegeria-1.5.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
100
|
-
pyegeria-1.5.1.dist-info/METADATA,sha256=
|
101
|
-
pyegeria-1.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
102
|
-
pyegeria-1.5.1.dist-info/entry_points.txt,sha256=
|
103
|
-
pyegeria-1.5.1.dist-info/RECORD,,
|
102
|
+
pyegeria-1.5.1.0.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
103
|
+
pyegeria-1.5.1.0.2.dist-info/METADATA,sha256=lLEhPlzG0QJjitsoOjWNL9uboq017iKF2bPxOaANuhU,2997
|
104
|
+
pyegeria-1.5.1.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
105
|
+
pyegeria-1.5.1.0.2.dist-info/entry_points.txt,sha256=i2uZoFIFKkWCywUBpoiCA4L39qr0r3uvbGmwYzy1WnM,3617
|
106
|
+
pyegeria-1.5.1.0.2.dist-info/RECORD,,
|
@@ -21,8 +21,9 @@ list_asset_types=commands.tech.list_asset_types:main
|
|
21
21
|
list_assets=commands.cat.list_assets:main
|
22
22
|
list_catalog_targets=commands.ops.list_catalog_targets:main
|
23
23
|
list_cert_types=commands.cat.list_cert_types:main
|
24
|
+
list_element_graph=commands.tech.get_element_graph:main
|
24
25
|
list_elements=commands.tech.list_elements:main
|
25
|
-
list_elements_by_classification=commands.tech.
|
26
|
+
list_elements_by_classification=commands.tech.list_elements_for_classification:main
|
26
27
|
list_engine_activity=commands.ops.monitor_engine_activity:main_paging
|
27
28
|
list_engine_activity_compressed=commands.ops.monitor_engine_activity_c:main_paging
|
28
29
|
list_glossary=commands.cat.list_glossary:main
|
File without changes
|
File without changes
|