pyegeria 1.5.1.0.12__py3-none-any.whl → 1.5.1.0.13__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 +111 -85
- commands/cat/list_deployed_databases.py +1 -1
- commands/cat/old_list_deployed_database_schemas.py +224 -0
- commands/cli/egeria.py +3 -1
- commands/cli/egeria_cat.py +3 -1
- commands/tech/list_related_elements.py +4 -2
- pyegeria/classification_manager_omvs.py +159 -0
- {pyegeria-1.5.1.0.12.dist-info → pyegeria-1.5.1.0.13.dist-info}/METADATA +1 -1
- {pyegeria-1.5.1.0.12.dist-info → pyegeria-1.5.1.0.13.dist-info}/RECORD +12 -11
- {pyegeria-1.5.1.0.12.dist-info → pyegeria-1.5.1.0.13.dist-info}/LICENSE +0 -0
- {pyegeria-1.5.1.0.12.dist-info → pyegeria-1.5.1.0.13.dist-info}/WHEEL +0 -0
- {pyegeria-1.5.1.0.12.dist-info → pyegeria-1.5.1.0.13.dist-info}/entry_points.txt +0 -0
@@ -46,6 +46,14 @@ def check_if_template(header: dict) -> bool:
|
|
46
46
|
return False
|
47
47
|
|
48
48
|
|
49
|
+
def make_prop_md(props: dict) -> str:
|
50
|
+
"""Given a properties dict, make a markdown string"""
|
51
|
+
props_md = ""
|
52
|
+
for key in props.keys():
|
53
|
+
props_md += f"* {key}: {props[key]}\n"
|
54
|
+
return props_md
|
55
|
+
|
56
|
+
|
49
57
|
def list_deployed_database_schemas(
|
50
58
|
db_name: str,
|
51
59
|
server: str,
|
@@ -84,102 +92,120 @@ def list_deployed_database_schemas(
|
|
84
92
|
|
85
93
|
om_type = "DeployedDatabaseSchema"
|
86
94
|
|
87
|
-
# get the
|
88
|
-
|
95
|
+
# First get the deployed schemas - either all of them or for a specific server
|
89
96
|
if db_name in (None, "*"):
|
90
97
|
dbs = c_client.get_elements(om_type)
|
91
98
|
else:
|
99
|
+
# get the guid for the database or catalog and then all schemas anchored on that catalog
|
92
100
|
db_guid = c_client.get_guid_for_name(db_name)
|
93
101
|
dbs = c_client.get_elements_by_classification_with_property_value(
|
94
102
|
"Anchors", db_guid, ["anchorGUID"], om_type
|
95
103
|
)
|
104
|
+
# Now we should have a list of Database/Catalog Schemas
|
96
105
|
|
97
|
-
if type(dbs) is list:
|
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
|
-
# if count > 1 and count < len_els:
|
160
|
-
# spacer = "---\n"
|
161
|
-
# elif count > len_els:
|
162
|
-
# spacer = ""
|
163
|
-
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
164
|
-
if count == len_els:
|
165
|
-
rel_el_md = rel_el_md[:-4]
|
166
|
-
rel_el_out = Markdown(rel_el_md)
|
167
|
-
|
168
|
-
table.add_row(
|
169
|
-
el_schema_id,
|
170
|
-
# el_type,
|
171
|
-
# el_created_out,
|
172
|
-
# el_home,
|
173
|
-
# el_guid,
|
174
|
-
el_props_out,
|
175
|
-
rel_el_out,
|
176
|
-
)
|
177
|
-
|
178
|
-
return table
|
179
|
-
else:
|
106
|
+
if type(dbs) is not list:
|
180
107
|
print("No instances found")
|
181
108
|
sys.exit(1)
|
182
109
|
|
110
|
+
for element in dbs:
|
111
|
+
header = element["elementHeader"]
|
112
|
+
|
113
|
+
if check_if_template(header):
|
114
|
+
continue
|
115
|
+
|
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
|
+
|
127
|
+
el_guid = header["guid"]
|
128
|
+
|
129
|
+
# get the information about the catalog we are part of
|
130
|
+
el_classification = header["classifications"]
|
131
|
+
for c in el_classification:
|
132
|
+
if c["type"]["typeName"] == "Anchors":
|
133
|
+
el_anchor_guid = c["classificationProperties"]["anchorGUID"]
|
134
|
+
el_anchor_type_name = c["classificationProperties"][
|
135
|
+
"anchorTypeName"
|
136
|
+
]
|
137
|
+
if el_anchor_type_name == "Catalog":
|
138
|
+
el_cat = c_client.get_element_by_guid(el_anchor_guid)
|
139
|
+
el_cat_name = el_cat["properties"].get("name", None)
|
140
|
+
if el_cat_name is None:
|
141
|
+
el_cat_name = el_cat["properties"].get(
|
142
|
+
"qualifiedName", "---"
|
143
|
+
)
|
144
|
+
el_cat_guid = el_cat["elementHeader"]["guid"]
|
145
|
+
el_schema_id = (
|
146
|
+
f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
|
147
|
+
)
|
148
|
+
|
149
|
+
# get the schema properties
|
150
|
+
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
|
+
|
155
|
+
# Now get property facets related to us
|
156
|
+
el_facets = c_client.get_related_elements(
|
157
|
+
el_guid, "ReferenceableFacet", None
|
158
|
+
)
|
159
|
+
el_facets_md = "---\n**Property Facets:**\n"
|
160
|
+
if type(el_facets) is list:
|
161
|
+
for facet in el_facets:
|
162
|
+
el_facets_md += make_prop_md(facet["relatedElement"]["properties"])
|
163
|
+
else:
|
164
|
+
el_facets_md += "--- \n"
|
165
|
+
# Add the facet properties under the normal properties
|
166
|
+
el_props_out = Markdown(f"{el_props_md}{el_facets_md}")
|
167
|
+
# get the Content within our schema
|
168
|
+
rel_elements = c_client.get_related_elements(
|
169
|
+
el_guid, "DataContentForDataSet", None
|
170
|
+
)
|
171
|
+
|
172
|
+
schema_md = ""
|
173
|
+
count = 0
|
174
|
+
rel_el_out = ""
|
175
|
+
if type(rel_elements) is list:
|
176
|
+
len_els = len(rel_elements)
|
177
|
+
rel_el_md = ""
|
178
|
+
spacer = "---\n"
|
179
|
+
for rel_element in rel_elements:
|
180
|
+
count += 1
|
181
|
+
rel_type = rel_element["relationshipHeader"]["type"]["typeName"]
|
182
|
+
rel_guid = rel_element["relationshipHeader"]["guid"]
|
183
|
+
rel_props = rel_element["relatedElement"]["properties"]
|
184
|
+
props_md = ""
|
185
|
+
for key in rel_props.keys():
|
186
|
+
props_md += f"\t* **{key}**: {rel_props[key]}\n"
|
187
|
+
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
188
|
+
# if count > 1 and count < len_els:
|
189
|
+
# spacer = "---\n"
|
190
|
+
# elif count > len_els:
|
191
|
+
# spacer = ""
|
192
|
+
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
193
|
+
if count == len_els:
|
194
|
+
rel_el_md = rel_el_md[:-4]
|
195
|
+
rel_el_out = Markdown(rel_el_md)
|
196
|
+
|
197
|
+
table.add_row(
|
198
|
+
el_schema_id,
|
199
|
+
# el_type,
|
200
|
+
# el_created_out,
|
201
|
+
# el_home,
|
202
|
+
# el_guid,
|
203
|
+
el_props_out,
|
204
|
+
rel_el_out,
|
205
|
+
)
|
206
|
+
|
207
|
+
return table
|
208
|
+
|
183
209
|
try:
|
184
210
|
console = Console(width=width, force_terminal=not jupyter)
|
185
211
|
|
@@ -32,7 +32,7 @@ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
|
32
32
|
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
33
33
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
34
34
|
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
35
|
-
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "
|
35
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "300"))
|
36
36
|
|
37
37
|
|
38
38
|
def check_if_template(header: dict) -> bool:
|
@@ -0,0 +1,224 @@
|
|
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("Home Store")
|
81
|
+
# table.add_column("GUID", width=38, no_wrap=True)
|
82
|
+
# table.add_column("Properties")
|
83
|
+
table.add_column("Cataloged Resource")
|
84
|
+
|
85
|
+
om_type = "DeployedDatabaseSchema"
|
86
|
+
|
87
|
+
# get the guid for the database or catalog
|
88
|
+
|
89
|
+
if db_name in (None, "*"):
|
90
|
+
dbs = c_client.get_elements(om_type)
|
91
|
+
else:
|
92
|
+
db_guid = c_client.get_guid_for_name(db_name)
|
93
|
+
dbs = c_client.get_elements_by_classification_with_property_value(
|
94
|
+
"Anchors", db_guid, ["anchorGUID"], om_type
|
95
|
+
)
|
96
|
+
|
97
|
+
if type(dbs) is not list:
|
98
|
+
print("No instances found")
|
99
|
+
sys.exit(1)
|
100
|
+
|
101
|
+
for element in dbs:
|
102
|
+
header = element["elementHeader"]
|
103
|
+
|
104
|
+
if check_if_template(header):
|
105
|
+
continue
|
106
|
+
|
107
|
+
el_name = element["properties"].get("name", "---")
|
108
|
+
el_type = header["type"]["typeName"]
|
109
|
+
el_home = header["origin"]["homeMetadataCollectionName"]
|
110
|
+
el_create_time = header["versions"]["createTime"][:-10]
|
111
|
+
el_created_by = header["versions"]["createdBy"]
|
112
|
+
el_created_md = (
|
113
|
+
f"* **Created By**: {el_created_by}\n"
|
114
|
+
f"* **Created Time**: {el_create_time}"
|
115
|
+
)
|
116
|
+
el_created_out = Markdown(el_created_md)
|
117
|
+
|
118
|
+
el_guid = header["guid"]
|
119
|
+
|
120
|
+
el_classification = header["classifications"]
|
121
|
+
for c in el_classification:
|
122
|
+
if c["type"]["typeName"] == "Anchors":
|
123
|
+
el_anchor_guid = c["classificationProperties"]["anchorGUID"]
|
124
|
+
el_anchor_type_name = c["classificationProperties"][
|
125
|
+
"anchorTypeName"
|
126
|
+
]
|
127
|
+
if el_anchor_type_name == "Catalog":
|
128
|
+
el_cat = c_client.get_element_by_guid(el_anchor_guid)
|
129
|
+
el_cat_name = el_cat["properties"].get("name", None)
|
130
|
+
if el_cat_name is None:
|
131
|
+
el_cat_name = el_cat["properties"].get(
|
132
|
+
"qualifiedName", "---"
|
133
|
+
)
|
134
|
+
el_cat_guid = el_cat["elementHeader"]["guid"]
|
135
|
+
el_schema_id = (
|
136
|
+
f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
|
137
|
+
)
|
138
|
+
el_props_md = ""
|
139
|
+
for prop in element["properties"].keys():
|
140
|
+
el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
|
141
|
+
el_props_out = Markdown(el_props_md)
|
142
|
+
|
143
|
+
rel_elements = c_client.get_elements_by_property_value(
|
144
|
+
el_guid, ["anchorGUID"]
|
145
|
+
)
|
146
|
+
schema_md = ""
|
147
|
+
count = 0
|
148
|
+
rel_el_out = ""
|
149
|
+
if type(rel_elements) is list:
|
150
|
+
len_els = len(rel_elements)
|
151
|
+
rel_el_md = ""
|
152
|
+
spacer = "---\n"
|
153
|
+
for rel_element in rel_elements:
|
154
|
+
count += 1
|
155
|
+
rel_type = rel_element["elementHeader"]["type"]["typeName"]
|
156
|
+
rel_guid = rel_element["elementHeader"]["guid"]
|
157
|
+
rel_props = rel_element["properties"]
|
158
|
+
props_md = ""
|
159
|
+
for key in rel_props.keys():
|
160
|
+
props_md += f"\t* **{key}**: {rel_props[key]}\n"
|
161
|
+
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
162
|
+
# if count > 1 and count < len_els:
|
163
|
+
# spacer = "---\n"
|
164
|
+
# elif count > len_els:
|
165
|
+
# spacer = ""
|
166
|
+
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
167
|
+
if count == len_els:
|
168
|
+
rel_el_md = rel_el_md[:-4]
|
169
|
+
rel_el_out = Markdown(rel_el_md)
|
170
|
+
|
171
|
+
table.add_row(
|
172
|
+
el_schema_id,
|
173
|
+
# el_type,
|
174
|
+
# el_created_out,
|
175
|
+
# el_home,
|
176
|
+
# el_guid,
|
177
|
+
el_props_out,
|
178
|
+
rel_el_out,
|
179
|
+
)
|
180
|
+
|
181
|
+
return table
|
182
|
+
|
183
|
+
try:
|
184
|
+
console = Console(width=width, force_terminal=not jupyter)
|
185
|
+
|
186
|
+
with console.pager(styles=True):
|
187
|
+
console.print(generate_table())
|
188
|
+
|
189
|
+
except (
|
190
|
+
InvalidParameterException,
|
191
|
+
PropertyServerException,
|
192
|
+
UserNotAuthorizedException,
|
193
|
+
) as e:
|
194
|
+
print_exception_response(e)
|
195
|
+
print("\n\nPerhaps the type name isn't known")
|
196
|
+
finally:
|
197
|
+
c_client.close_session()
|
198
|
+
|
199
|
+
|
200
|
+
def main():
|
201
|
+
parser = argparse.ArgumentParser()
|
202
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
203
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
204
|
+
parser.add_argument("--userid", help="User Id")
|
205
|
+
parser.add_argument("--password", help="Password")
|
206
|
+
|
207
|
+
args = parser.parse_args()
|
208
|
+
|
209
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
210
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
211
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
212
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
213
|
+
|
214
|
+
try:
|
215
|
+
db_name = Prompt.ask(
|
216
|
+
"Enter the name of a database/catalog to retrieve schemas for", default="*"
|
217
|
+
)
|
218
|
+
list_deployed_database_schemas(db_name, server, url, userid, password)
|
219
|
+
except KeyboardInterrupt:
|
220
|
+
pass
|
221
|
+
|
222
|
+
|
223
|
+
if __name__ == "__main__":
|
224
|
+
main()
|
commands/cli/egeria.py
CHANGED
@@ -32,7 +32,9 @@ 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.
|
35
|
+
from commands.cat.old_list_deployed_database_schemas import (
|
36
|
+
list_deployed_database_schemas,
|
37
|
+
)
|
36
38
|
from commands.cat.list_deployed_catalogs import list_deployed_catalogs
|
37
39
|
from commands.cat.list_deployed_databases import list_deployed_databases
|
38
40
|
from commands.cat.glossary_actions import create_glossary, delete_glossary, create_term
|
commands/cli/egeria_cat.py
CHANGED
@@ -23,7 +23,9 @@ from commands.cat.list_archives import display_archive_list
|
|
23
23
|
from commands.cat.list_assets import display_assets
|
24
24
|
from commands.cat.list_cert_types import display_certifications
|
25
25
|
from commands.cat.list_deployed_catalogs import list_deployed_catalogs
|
26
|
-
from commands.cat.
|
26
|
+
from commands.cat.old_list_deployed_database_schemas import (
|
27
|
+
list_deployed_database_schemas,
|
28
|
+
)
|
27
29
|
from commands.cat.list_deployed_databases import list_deployed_databases
|
28
30
|
from commands.cat.list_glossary import display_glossary_terms
|
29
31
|
from commands.cat.list_projects import display_project_list
|
@@ -186,10 +186,12 @@ def main():
|
|
186
186
|
|
187
187
|
try:
|
188
188
|
element_guid = Prompt.ask("Guid of base element").strip()
|
189
|
-
om_type = Prompt.ask(
|
189
|
+
om_type = Prompt.ask(
|
190
|
+
"Enter the Open Metadata Type to find elements of", default=None
|
191
|
+
)
|
190
192
|
relationship_type = Prompt.ask("Enter the relationship type to follow")
|
191
193
|
|
192
|
-
om_type =
|
194
|
+
om_type = om_type.strip() if type(om_type) is str else None
|
193
195
|
relationship_type = (
|
194
196
|
None if len(relationship_type) == 0 else relationship_type.strip()
|
195
197
|
)
|
@@ -381,6 +381,165 @@ class ClassificationManager(Client):
|
|
381
381
|
)
|
382
382
|
return response
|
383
383
|
|
384
|
+
async def _async_find_elements_by_property_value(
|
385
|
+
self,
|
386
|
+
property_value: str,
|
387
|
+
property_names: [str],
|
388
|
+
open_metadata_type_name: str = None,
|
389
|
+
effective_time: str = None,
|
390
|
+
for_lineage: bool = None,
|
391
|
+
for_duplicate_processing: bool = None,
|
392
|
+
start_from: int = 0,
|
393
|
+
page_size: int = max_paging_size,
|
394
|
+
time_out: int = default_time_out,
|
395
|
+
) -> list | str:
|
396
|
+
"""
|
397
|
+
Retrieve elements by a value found in one of the properties specified. The value must only be contained in the
|
398
|
+
properties rather than needing to be an exact match. An open metadata type name may be supplied to restrict the
|
399
|
+
results. Async version.
|
400
|
+
|
401
|
+
https://egeria-project.org/types/
|
402
|
+
|
403
|
+
Parameters
|
404
|
+
----------
|
405
|
+
property_value: str
|
406
|
+
- property value to be searched.
|
407
|
+
property_names: [str]
|
408
|
+
- property names to search in.
|
409
|
+
open_metadata_type_name : str, default = None
|
410
|
+
- open metadata type to be used to restrict the search
|
411
|
+
effective_time: str, default = None
|
412
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
413
|
+
for_lineage: bool, default is set by server
|
414
|
+
- determines if elements classified as Memento should be returned - normally false
|
415
|
+
for_duplicate_processing: bool, default is set by server
|
416
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
417
|
+
start_from: int, default = 0
|
418
|
+
- index of the list to start from (0 for start).
|
419
|
+
page_size
|
420
|
+
- maximum number of elements to return.
|
421
|
+
|
422
|
+
|
423
|
+
time_out: int, default = default_time_out
|
424
|
+
- http request timeout for this request
|
425
|
+
|
426
|
+
Returns
|
427
|
+
-------
|
428
|
+
[dict] | str
|
429
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
430
|
+
|
431
|
+
Raises
|
432
|
+
------
|
433
|
+
InvalidParameterException
|
434
|
+
one of the parameters is null or invalid or
|
435
|
+
PropertyServerException
|
436
|
+
There is a problem adding the element properties to the metadata repository or
|
437
|
+
UserNotAuthorizedException
|
438
|
+
the requesting user is not authorized to issue this request.
|
439
|
+
"""
|
440
|
+
|
441
|
+
possible_query_params = query_string(
|
442
|
+
[
|
443
|
+
("startFrom", start_from),
|
444
|
+
("pageSize", page_size),
|
445
|
+
("forLineage", for_lineage),
|
446
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
447
|
+
]
|
448
|
+
)
|
449
|
+
|
450
|
+
body = {
|
451
|
+
"class": "FindPropertyNamesProperties",
|
452
|
+
"openMetadataTypeName": open_metadata_type_name,
|
453
|
+
"propertyValue": property_value,
|
454
|
+
"propertyNames": property_names,
|
455
|
+
"effectiveTime": effective_time,
|
456
|
+
}
|
457
|
+
|
458
|
+
url = f"{base_path(self, self.view_server)}/elements/by-property-value-search{possible_query_params}"
|
459
|
+
|
460
|
+
response: Response = await self._async_make_request(
|
461
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
462
|
+
)
|
463
|
+
|
464
|
+
elements = response.json().get("elements", "No elements found")
|
465
|
+
if type(elements) is list:
|
466
|
+
if len(elements) == 0:
|
467
|
+
return "No elements found"
|
468
|
+
return elements
|
469
|
+
|
470
|
+
def find_elements_by_property_value(
|
471
|
+
self,
|
472
|
+
property_value: str,
|
473
|
+
property_names: [str],
|
474
|
+
open_metadata_type_name: str = None,
|
475
|
+
effective_time: str = None,
|
476
|
+
for_lineage: bool = None,
|
477
|
+
for_duplicate_processing: bool = None,
|
478
|
+
start_from: int = 0,
|
479
|
+
page_size: int = max_paging_size,
|
480
|
+
time_out: int = default_time_out,
|
481
|
+
) -> list | str:
|
482
|
+
"""
|
483
|
+
Retrieve elements by a value found in one of the properties specified. The value must only be contained in the
|
484
|
+
properties rather than needing to be an exact match. An open metadata type name may be supplied to restrict the
|
485
|
+
results.
|
486
|
+
|
487
|
+
https://egeria-project.org/types/
|
488
|
+
|
489
|
+
Parameters
|
490
|
+
----------
|
491
|
+
property_value: str
|
492
|
+
- property value to be searched.
|
493
|
+
property_names: [str]
|
494
|
+
- property names to search in.
|
495
|
+
open_metadata_type_name : str, default = None
|
496
|
+
- open metadata type to be used to restrict the search
|
497
|
+
effective_time: str, default = None
|
498
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
499
|
+
for_lineage: bool, default is set by server
|
500
|
+
- determines if elements classified as Memento should be returned - normally false
|
501
|
+
for_duplicate_processing: bool, default is set by server
|
502
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
503
|
+
start_from: int, default = 0
|
504
|
+
- index of the list to start from (0 for start).
|
505
|
+
page_size
|
506
|
+
- maximum number of elements to return.
|
507
|
+
|
508
|
+
|
509
|
+
time_out: int, default = default_time_out
|
510
|
+
- http request timeout for this request
|
511
|
+
|
512
|
+
Returns
|
513
|
+
-------
|
514
|
+
[dict] | str
|
515
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
516
|
+
|
517
|
+
Raises
|
518
|
+
------
|
519
|
+
InvalidParameterException
|
520
|
+
one of the parameters is null or invalid or
|
521
|
+
PropertyServerException
|
522
|
+
There is a problem adding the element properties to the metadata repository or
|
523
|
+
UserNotAuthorizedException
|
524
|
+
the requesting user is not authorized to issue this request.
|
525
|
+
"""
|
526
|
+
|
527
|
+
loop = asyncio.get_event_loop()
|
528
|
+
response = loop.run_until_complete(
|
529
|
+
self._async_find_elements_by_property_value(
|
530
|
+
property_value,
|
531
|
+
property_names,
|
532
|
+
open_metadata_type_name,
|
533
|
+
effective_time,
|
534
|
+
for_lineage,
|
535
|
+
for_duplicate_processing,
|
536
|
+
start_from,
|
537
|
+
page_size,
|
538
|
+
time_out,
|
539
|
+
)
|
540
|
+
)
|
541
|
+
return response
|
542
|
+
|
384
543
|
async def _async_get_element_by_guid(
|
385
544
|
self,
|
386
545
|
element_guid: str,
|
@@ -11,17 +11,18 @@ 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=
|
15
|
-
commands/cat/list_deployed_databases.py,sha256=
|
14
|
+
commands/cat/list_deployed_database_schemas.py,sha256=cYT1tDObfcwo-fTYGiaGVqYnd9liPGvIvhmkPcmb4Q0,9463
|
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
|
18
18
|
commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468GYw3Q,5869
|
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=R3TtZ77pVbjLYNg08CIBaHqe-p6jr1TI1uuZryVCJ68,8232
|
22
23
|
commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
|
23
|
-
commands/cli/egeria.py,sha256=
|
24
|
-
commands/cli/egeria_cat.py,sha256=
|
24
|
+
commands/cli/egeria.py,sha256=HwEYm8TkRQ7b0kFG88Tl-_UI0Fm4U5Jq_s63xOBOHEc,31269
|
25
|
+
commands/cli/egeria_cat.py,sha256=654GO8wGToYDAYWGXHaacGwuaz0vkkKRFu1vNPKsleM,14804
|
25
26
|
commands/cli/egeria_my.py,sha256=9zIpUDLeA_R-0rgCSQfEZTtVmkxPcEAsYcCTn1wQFrE,6181
|
26
27
|
commands/cli/egeria_ops.py,sha256=fxDXYWXRhexx06PdSLCp2FhgUtS13NdDpyg7ea775fc,11531
|
27
28
|
commands/cli/egeria_tech.py,sha256=eTDHTHDVEYmr6gUPGfido_Uf7Fec0Nuyxlkhg4KAMAw,13160
|
@@ -63,7 +64,7 @@ commands/tech/list_elements_for_classification.py,sha256=oAge8RFz4z9H-jCE0fBDhS4
|
|
63
64
|
commands/tech/list_elements_x.py,sha256=k5jkekB7wh6cbzjn7FnwL7pKrPFq_oE-x36c_Z1FuSo,6500
|
64
65
|
commands/tech/list_gov_action_processes.py,sha256=AeS4E-DWrS2etsM6nuYD1En1J-7KeB_ZjyLTO9sy6KU,4580
|
65
66
|
commands/tech/list_registered_services.py,sha256=QzE_ebdopNkHWMxa-xc902GG6ac4Yw-ln8i8NUsgHVA,6542
|
66
|
-
commands/tech/list_related_elements.py,sha256=
|
67
|
+
commands/tech/list_related_elements.py,sha256=mcOy3RIGpIdshcT1o4Tr7Ck-c1dmAC8yBUOF5GAFYrM,7755
|
67
68
|
commands/tech/list_related_specification.py,sha256=mWrKenXOskL4cl0DHjH2Z8M9-FJzjkzK62W-tsx3WDU,5918
|
68
69
|
commands/tech/list_relationship_types.py,sha256=BlVzrPznZXqMVLN2-2vYEVRGeYsiJrqXxIJEikobyoo,5875
|
69
70
|
commands/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
|
@@ -78,7 +79,7 @@ pyegeria/_globals.py,sha256=1Uc8392wjbiVN5L__RzxC1-U97RMXj77_iUsMSgeAjQ,638
|
|
78
79
|
pyegeria/_validators.py,sha256=rnZelHJnjHaLZ8UhUTDyB59MfIUJifhALtkYoHBaos4,12736
|
79
80
|
pyegeria/asset_catalog_omvs.py,sha256=NUF9C3s_zs9pTfIZyRJlqMCKrhZASJPH08EXzzjki7g,21120
|
80
81
|
pyegeria/automated_curation_omvs.py,sha256=Wj9g3Vcx8VmbogxG_kusX38CUylq2r5ZM2sReqUQ-U4,136332
|
81
|
-
pyegeria/classification_manager_omvs.py,sha256=
|
82
|
+
pyegeria/classification_manager_omvs.py,sha256=3yInuRy7Cf43oSFZ8BuzcIgtGSm5BfvlKYqtWKRMlPU,186678
|
82
83
|
pyegeria/collection_manager_omvs.py,sha256=kye2kjthNnmwxMZhHQKV0xoHbxcNPWjNzRAYOItj_gY,99201
|
83
84
|
pyegeria/core_omag_server_config.py,sha256=EtHaPKyc9d6pwTgbnQqGwe5lSBMPIfJOlbJEa1zg1JA,94946
|
84
85
|
pyegeria/create_tech_guid_lists.py,sha256=HHkC6HW58EN1BiolrYSRqSE0JhPbTepOFzwtdwBxVaU,4640
|
@@ -101,8 +102,8 @@ pyegeria/server_operations.py,sha256=ciH890hYT85YQ6OpByn4w7s3a7TtvWZpIG5rkRqbcI0
|
|
101
102
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
102
103
|
pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
|
103
104
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
104
|
-
pyegeria-1.5.1.0.
|
105
|
-
pyegeria-1.5.1.0.
|
106
|
-
pyegeria-1.5.1.0.
|
107
|
-
pyegeria-1.5.1.0.
|
108
|
-
pyegeria-1.5.1.0.
|
105
|
+
pyegeria-1.5.1.0.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
106
|
+
pyegeria-1.5.1.0.13.dist-info/METADATA,sha256=RiuX10FSRjKacDLJIl_68foWqVoJvhDrcop6HaUZZWA,2998
|
107
|
+
pyegeria-1.5.1.0.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
108
|
+
pyegeria-1.5.1.0.13.dist-info/entry_points.txt,sha256=Pc5kHnxv-vbRpwVMxSSWl66vmf7EZjgzf7nZzz1ow3M,4002
|
109
|
+
pyegeria-1.5.1.0.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|