pyegeria 0.3.8__py3-none-any.whl → 0.4.0__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.
- pyegeria/Xfeedback_manager_omvs.py +238 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +15 -12
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +3 -1
- pyegeria/asset_catalog_omvs.py +672 -0
- pyegeria/automated_curation_omvs.py +627 -359
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/glossary_manager_omvs.py +3002 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/runtime_manager_omvs.py +967 -0
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +204 -43
- pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
- pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
- pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
- pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
- pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
- pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
- pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
- pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
- pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
- pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
- pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
- pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
- pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
- pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
- pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
- pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
- pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
- pyegeria-0.4.0.dist-info/RECORD +58 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
- /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
pyegeria/glossary_omvs.py
DELETED
@@ -1,789 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
PDX-License-Identifier: Apache-2.0
|
3
|
-
Copyright Contributors to the ODPi Egeria project.
|
4
|
-
|
5
|
-
This module contains an initial version of the glossary_omvs module. There are additional methods that will be
|
6
|
-
added in subsequent versions of the glossary_omvs module.
|
7
|
-
|
8
|
-
"""
|
9
|
-
import json
|
10
|
-
from datetime import datetime
|
11
|
-
import asyncio
|
12
|
-
|
13
|
-
# import json
|
14
|
-
from pyegeria._client import Client, max_paging_size
|
15
|
-
from pyegeria._globals import enable_ssl_check
|
16
|
-
from pyegeria._validators import (
|
17
|
-
validate_name,
|
18
|
-
validate_guid,
|
19
|
-
validate_url, validate_search_string,
|
20
|
-
)
|
21
|
-
from pyegeria.utils import body_slimmer
|
22
|
-
|
23
|
-
|
24
|
-
class GlossaryBrowser(Client):
|
25
|
-
"""
|
26
|
-
GlossaryBrowser is a class that extends the Client class. It provides methods to search and retrieve glossaries,
|
27
|
-
terms and categories.
|
28
|
-
|
29
|
-
Attributes:
|
30
|
-
|
31
|
-
server_name: str
|
32
|
-
The name of the View Server to connect to.
|
33
|
-
platform_url : str
|
34
|
-
URL of the server platform to connect to
|
35
|
-
user_id : str
|
36
|
-
The identity of the user calling the method - this sets a default optionally used by the methods
|
37
|
-
when the user doesn't pass the user_id on a method call.
|
38
|
-
user_pwd: str
|
39
|
-
The password associated with the user_id. Defaults to None
|
40
|
-
verify_flag: bool
|
41
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
42
|
-
Defaults to False.
|
43
|
-
|
44
|
-
"""
|
45
|
-
|
46
|
-
def __init__(
|
47
|
-
self,
|
48
|
-
server_name: str,
|
49
|
-
platform_url: str,
|
50
|
-
token: str = None,
|
51
|
-
user_id: str = None,
|
52
|
-
user_pwd: str = None,
|
53
|
-
verify_flag: bool = enable_ssl_check,
|
54
|
-
sync_mode: bool = True
|
55
|
-
):
|
56
|
-
self.admin_command_root: str
|
57
|
-
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
|
58
|
-
|
59
|
-
#
|
60
|
-
# Glossaries
|
61
|
-
#
|
62
|
-
async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
63
|
-
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
64
|
-
for_duplicate_processing: bool = False, type_name: str = None,
|
65
|
-
server_name: str = None,
|
66
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
67
|
-
""" Retrieve the list of glossary metadata elements that contain the search string. Async version.
|
68
|
-
The search string is located in the request body and is interpreted as a plain string.
|
69
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
70
|
-
|
71
|
-
Parameters
|
72
|
-
----------
|
73
|
-
search_string: str,
|
74
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
75
|
-
|
76
|
-
effective_time: str, [default=None], optional
|
77
|
-
Effective time of the query. If not specified will default to any time.
|
78
|
-
server_name : str, optional
|
79
|
-
The name of the server to configure.
|
80
|
-
If not provided, the server name associated with the instance is used.
|
81
|
-
starts_with : bool, [default=False], optional
|
82
|
-
Starts with the supplied string.
|
83
|
-
ends_with : bool, [default=False], optional
|
84
|
-
Ends with the supplied string
|
85
|
-
ignore_case : bool, [default=False], optional
|
86
|
-
Ignore case when searching
|
87
|
-
for_lineage : bool, [default=False], optional
|
88
|
-
|
89
|
-
for_duplicate_processing : bool, [default=False], optional
|
90
|
-
type_name: str, [default=None], optional
|
91
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
92
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
93
|
-
start_from: int, [default=0], optional
|
94
|
-
When multiple pages of results are available, the page number to start from.
|
95
|
-
page_size: int, [default=None]
|
96
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
97
|
-
the class instance.
|
98
|
-
Returns
|
99
|
-
-------
|
100
|
-
List | str
|
101
|
-
|
102
|
-
A list of glossary definitions active in the server.
|
103
|
-
|
104
|
-
Raises
|
105
|
-
------
|
106
|
-
|
107
|
-
InvalidParameterException
|
108
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
109
|
-
PropertyServerException
|
110
|
-
Raised by the server when an issue arises in processing a valid request
|
111
|
-
NotAuthorizedException
|
112
|
-
The principle specified by the user_id does not have authorization for the requested action
|
113
|
-
|
114
|
-
"""
|
115
|
-
if server_name is None:
|
116
|
-
server_name = self.server_name
|
117
|
-
if page_size is None:
|
118
|
-
page_size = self.page_size
|
119
|
-
starts_with_s = str(starts_with).lower()
|
120
|
-
ends_with_s = str(ends_with).lower()
|
121
|
-
ignore_case_s = str(ignore_case).lower()
|
122
|
-
for_lineage_s = str(for_lineage).lower()
|
123
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
124
|
-
|
125
|
-
validate_search_string(search_string)
|
126
|
-
|
127
|
-
if search_string == '*':
|
128
|
-
search_string = None
|
129
|
-
|
130
|
-
body = {
|
131
|
-
"class": "SearchStringRequestBody",
|
132
|
-
"searchString": search_string,
|
133
|
-
"effectiveTime": effective_time,
|
134
|
-
"typeName": type_name
|
135
|
-
}
|
136
|
-
body = body_slimmer(body)
|
137
|
-
# print(f"\n\nBody is: \n{body}")
|
138
|
-
|
139
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
140
|
-
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
141
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
142
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
143
|
-
|
144
|
-
response = await self._async_make_request("POST", url, body)
|
145
|
-
return response
|
146
|
-
|
147
|
-
def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
148
|
-
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
149
|
-
for_duplicate_processing: bool = False, type_name: str = None, server_name: str = None,
|
150
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
151
|
-
""" Retrieve the list of glossary metadata elements that contain the search string.
|
152
|
-
The search string is located in the request body and is interpreted as a plain string.
|
153
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
154
|
-
|
155
|
-
Parameters
|
156
|
-
----------
|
157
|
-
search_string: str,
|
158
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
159
|
-
|
160
|
-
effective_time: str, [default=None], optional
|
161
|
-
Effective time of the query. If not specified will default to any time.
|
162
|
-
server_name : str, optional
|
163
|
-
The name of the server to configure.
|
164
|
-
If not provided, the server name associated with the instance is used.
|
165
|
-
starts_with : bool, [default=False], optional
|
166
|
-
Starts with the supplied string.
|
167
|
-
ends_with : bool, [default=False], optional
|
168
|
-
Ends with the supplied string
|
169
|
-
ignore_case : bool, [default=False], optional
|
170
|
-
Ignore case when searching
|
171
|
-
for_lineage : bool, [default=False], optional
|
172
|
-
Indicates the search is for lineage.
|
173
|
-
for_duplicate_processing : bool, [default=False], optional
|
174
|
-
type_name: str, [default=None], optional
|
175
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
176
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
177
|
-
start_from: int, [default=0], optional
|
178
|
-
When multiple pages of results are available, the page number to start from.
|
179
|
-
page_size: int, [default=None]
|
180
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
181
|
-
the class instance.
|
182
|
-
Returns
|
183
|
-
-------
|
184
|
-
List | str
|
185
|
-
|
186
|
-
A list of glossary definitions active in the server.
|
187
|
-
|
188
|
-
Raises
|
189
|
-
------
|
190
|
-
|
191
|
-
InvalidParameterException
|
192
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
193
|
-
PropertyServerException
|
194
|
-
Raised by the server when an issue arises in processing a valid request
|
195
|
-
NotAuthorizedException
|
196
|
-
The principle specified by the user_id does not have authorization for the requested action
|
197
|
-
|
198
|
-
"""
|
199
|
-
loop = asyncio.get_event_loop()
|
200
|
-
response = loop.run_until_complete(self._async_find_glossaries(search_string, effective_time, starts_with,
|
201
|
-
ends_with, ignore_case, for_lineage,
|
202
|
-
for_duplicate_processing,type_name,
|
203
|
-
server_name,start_from, page_size))
|
204
|
-
|
205
|
-
return response.json().get("elementList", "No Glossaries found")
|
206
|
-
|
207
|
-
async def _async_get_glossary_by_guid(self, glossary_guid: str, server_name: str = None,
|
208
|
-
effective_time: str = None) -> dict:
|
209
|
-
""" Retrieves information about a glossary
|
210
|
-
Parameters
|
211
|
-
----------
|
212
|
-
glossary_guid : str
|
213
|
-
Unique idetifier for the glossary
|
214
|
-
server_name : str, optional
|
215
|
-
The name of the server to get the configured access services for.
|
216
|
-
If not provided, the server name associated with the instance is used.
|
217
|
-
effective_time: str, optional
|
218
|
-
Effective time of the query. If not specified will default to any time.
|
219
|
-
Returns
|
220
|
-
-------
|
221
|
-
dict
|
222
|
-
The glossary definition associated with the glossary_guid
|
223
|
-
|
224
|
-
Raises
|
225
|
-
------
|
226
|
-
InvalidParameterException
|
227
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
228
|
-
PropertyServerException
|
229
|
-
Raised by the server when an issue arises in processing a valid request.
|
230
|
-
NotAuthorizedException
|
231
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
232
|
-
Notes
|
233
|
-
-----
|
234
|
-
"""
|
235
|
-
if server_name is None:
|
236
|
-
server_name = self.server_name
|
237
|
-
validate_guid(glossary_guid)
|
238
|
-
|
239
|
-
body = {
|
240
|
-
"class": "EffectiveTimeQueryRequestBody",
|
241
|
-
"effectiveTime": effective_time
|
242
|
-
}
|
243
|
-
|
244
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
245
|
-
f"{glossary_guid}/retrieve")
|
246
|
-
print(url)
|
247
|
-
response = await self._async_make_request("POST", url, payload=body)
|
248
|
-
return response
|
249
|
-
|
250
|
-
def get_glossary_by_guid(self, glossary_guid: str, server_name: str = None) -> dict:
|
251
|
-
""" Retrieves information about a glossary
|
252
|
-
Parameters
|
253
|
-
----------
|
254
|
-
glossary_guid : str
|
255
|
-
Unique idetifier for the glossary
|
256
|
-
server_name : str, optional
|
257
|
-
The name of the server to get the configured access services for.
|
258
|
-
If not provided, the server name associated with the instance is used.
|
259
|
-
Returns
|
260
|
-
-------
|
261
|
-
dict
|
262
|
-
The glossary definition associated with the glossary_guid
|
263
|
-
|
264
|
-
Raises
|
265
|
-
------
|
266
|
-
InvalidParameterException
|
267
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
268
|
-
PropertyServerException
|
269
|
-
Raised by the server when an issue arises in processing a valid request.
|
270
|
-
NotAuthorizedException
|
271
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
272
|
-
Notes
|
273
|
-
-----
|
274
|
-
"""
|
275
|
-
loop = asyncio.get_event_loop()
|
276
|
-
response = loop.run_until_complete(self._async_get_glossary_by_guid(glossary_guid, server_name))
|
277
|
-
return response
|
278
|
-
|
279
|
-
async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: datetime = None,
|
280
|
-
server_name: str = None,
|
281
|
-
start_from: int = 0, page_size: int = None) -> dict | str:
|
282
|
-
""" Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
283
|
-
There are no wildcards supported on this request.
|
284
|
-
|
285
|
-
Parameters
|
286
|
-
----------
|
287
|
-
glossary_name: str,
|
288
|
-
Name of the glossary to be retrieved
|
289
|
-
effective_time: datetime, [default=None], optional
|
290
|
-
Effective time of the query. If not specified will default to any effective time.
|
291
|
-
server_name : str, optional
|
292
|
-
The name of the server to configure.
|
293
|
-
If not provided, the server name associated with the instance is used.
|
294
|
-
start_from: int, [default=0], optional
|
295
|
-
When multiple pages of results are available, the page number to start from.
|
296
|
-
page_size: int, [default=None]
|
297
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
298
|
-
the class instance.
|
299
|
-
|
300
|
-
Returns
|
301
|
-
-------
|
302
|
-
None
|
303
|
-
|
304
|
-
Raises
|
305
|
-
------
|
306
|
-
|
307
|
-
InvalidParameterException
|
308
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
309
|
-
PropertyServerException
|
310
|
-
Raised by the server when an issue arises in processing a valid request
|
311
|
-
NotAuthorizedException
|
312
|
-
The principle specified by the user_id does not have authorization for the requested action
|
313
|
-
ConfigurationErrorException
|
314
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
315
|
-
invalid or make the new call invalid.
|
316
|
-
"""
|
317
|
-
if server_name is None:
|
318
|
-
server_name = self.server_name
|
319
|
-
if page_size is None:
|
320
|
-
page_size = self.page_size
|
321
|
-
validate_name(glossary_name)
|
322
|
-
|
323
|
-
if effective_time is None:
|
324
|
-
body = {"name": glossary_name}
|
325
|
-
else:
|
326
|
-
body = {"name": glossary_name, "effectiveTime": effective_time}
|
327
|
-
|
328
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
329
|
-
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
330
|
-
|
331
|
-
response = await self._async_make_request("POST", url, body)
|
332
|
-
return response.json()
|
333
|
-
|
334
|
-
def get_glossaries_by_name(self, glossary_name: str, effective_time: datetime = None, server_name: str = None,
|
335
|
-
start_from: int = 0, page_size: int = None) -> dict | str:
|
336
|
-
""" Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
337
|
-
There are no wildcards supported on this request.
|
338
|
-
|
339
|
-
Parameters
|
340
|
-
----------
|
341
|
-
glossary_name: str,
|
342
|
-
Name of the glossary to be retrieved
|
343
|
-
effective_time: datetime, [default=None], optional
|
344
|
-
Effective time of the query. If not specified will default to any effective time.
|
345
|
-
server_name : str, optional
|
346
|
-
The name of the server to configure.
|
347
|
-
If not provided, the server name associated with the instance is used.
|
348
|
-
start_from: int, [default=0], optional
|
349
|
-
When multiple pages of results are available, the page number to start from.
|
350
|
-
page_size: int, [default=None]
|
351
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
352
|
-
he class instance.
|
353
|
-
|
354
|
-
Returns
|
355
|
-
-------
|
356
|
-
None
|
357
|
-
|
358
|
-
Raises
|
359
|
-
------
|
360
|
-
InvalidParameterException
|
361
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
362
|
-
PropertyServerException
|
363
|
-
Raised by the server when an issue arises in processing a valid request
|
364
|
-
NotAuthorizedException
|
365
|
-
The principle specified by the user_id does not have authorization for the requested action
|
366
|
-
ConfigurationErrorException
|
367
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
368
|
-
invalid or make the new call invalid.
|
369
|
-
"""
|
370
|
-
loop = asyncio.get_event_loop()
|
371
|
-
response = loop.run_until_complete(self._async_get_glossaries_by_name(glossary_name, effective_time,
|
372
|
-
server_name, start_from, page_size))
|
373
|
-
return response
|
374
|
-
|
375
|
-
async def _async_get_terms_for_glossary(self, glossary_guid: str, server_name: str = None,
|
376
|
-
effective_time: datetime = None,
|
377
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
378
|
-
""" Retrieve the list of glossary terms associated with a glossary.
|
379
|
-
The request body also supports the specification of an effective time for the query.
|
380
|
-
Parameters
|
381
|
-
----------
|
382
|
-
glossary_guid : str
|
383
|
-
Unique identifier for the glossary
|
384
|
-
server_name : str, optional
|
385
|
-
The name of the server to get the configured access services for.
|
386
|
-
If not provided, the server name associated with the instance is used.
|
387
|
-
effective_time : str, optional
|
388
|
-
If specified, the query is performed as of the `effective_time`
|
389
|
-
start_from: int, optional defaults to 0
|
390
|
-
The page number to start retrieving elements from
|
391
|
-
page_size : int, optional defaults to None
|
392
|
-
The number of elements to retrieve
|
393
|
-
Returns
|
394
|
-
-------
|
395
|
-
dict
|
396
|
-
The glossary definition associated with the glossary_guid
|
397
|
-
|
398
|
-
Raises
|
399
|
-
------
|
400
|
-
InvalidParameterException
|
401
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
402
|
-
PropertyServerException
|
403
|
-
Raised by the server when an issue arises in processing a valid request.
|
404
|
-
NotAuthorizedException
|
405
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
406
|
-
Notes
|
407
|
-
-----
|
408
|
-
"""
|
409
|
-
|
410
|
-
if server_name is None:
|
411
|
-
server_name = self.server_name
|
412
|
-
validate_guid(glossary_guid)
|
413
|
-
|
414
|
-
if page_size is None:
|
415
|
-
page_size = self.page_size
|
416
|
-
|
417
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
418
|
-
f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
|
419
|
-
|
420
|
-
if effective_time is not None:
|
421
|
-
body = {
|
422
|
-
"effectiveTime": str(effective_time)
|
423
|
-
}
|
424
|
-
response = await self._async_make_request("POST", url, body)
|
425
|
-
else:
|
426
|
-
response = await self._async_make_request("POST", url)
|
427
|
-
|
428
|
-
return response.json().get("elementList", "No terms found")
|
429
|
-
|
430
|
-
def get_terms_for_glossary(self, glossary_guid: str, server_name: str = None, effective_time: datetime = None,
|
431
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
432
|
-
""" Retrieve the list of glossary terms associated with a glossary.
|
433
|
-
The request body also supports the specification of an effective time for the query.
|
434
|
-
Parameters
|
435
|
-
----------
|
436
|
-
glossary_guid : str
|
437
|
-
Unique identifier for the glossary
|
438
|
-
server_name : str, optional
|
439
|
-
The name of the server to get the configured access services for.
|
440
|
-
If not provided, the server name associated with the instance is used.
|
441
|
-
effective_time : str, optional
|
442
|
-
If specified, the query is performed as of the `effective_time`
|
443
|
-
start_from: int, optional defaults to 0
|
444
|
-
The page number to start retrieving elements from
|
445
|
-
page_size : int, optional defaults to None
|
446
|
-
The number of elements to retrieve
|
447
|
-
Returns
|
448
|
-
-------
|
449
|
-
dict
|
450
|
-
The glossary definition associated with the glossary_guid
|
451
|
-
|
452
|
-
Raises
|
453
|
-
------
|
454
|
-
InvalidParameterException
|
455
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
456
|
-
PropertyServerException
|
457
|
-
Raised by the server when an issue arises in processing a valid request.
|
458
|
-
NotAuthorizedException
|
459
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
460
|
-
Notes
|
461
|
-
-----
|
462
|
-
"""
|
463
|
-
loop = asyncio.get_event_loop()
|
464
|
-
response = loop.run_until_complete(self._async_get_terms_for_glossary(glossary_guid, server_name,
|
465
|
-
effective_time, start_from,
|
466
|
-
page_size))
|
467
|
-
|
468
|
-
return response
|
469
|
-
|
470
|
-
async def _async_get_glossary_for_term(self, term_guid: str, server_name: str = None,
|
471
|
-
effective_time: datetime = None,
|
472
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict:
|
473
|
-
if server_name is None:
|
474
|
-
server_name = self.server_name
|
475
|
-
validate_guid(term_guid)
|
476
|
-
for_lineage_s = str(for_lineage).lower()
|
477
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
478
|
-
|
479
|
-
body = {
|
480
|
-
"class": "EffectiveTimeQueryRequestBody",
|
481
|
-
"effectiveTime": effective_time
|
482
|
-
}
|
483
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
484
|
-
f"for-term/{term_guid}/retrieve?forLineage={for_lineage_s}&"
|
485
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}"
|
486
|
-
|
487
|
-
)
|
488
|
-
|
489
|
-
response = await self._async_make_request("POST", url, body)
|
490
|
-
return json.loads(response.text)
|
491
|
-
|
492
|
-
def get_glossary_for_term(self, term_guid: str, server_name: str = None, effective_time: datetime = None,
|
493
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict:
|
494
|
-
loop = asyncio.get_event_loop()
|
495
|
-
response = loop.run_until_complete(self._async_get_glossary_for_term(term_guid, server_name,
|
496
|
-
effective_time, for_lineage,
|
497
|
-
for_duplicate_processing))
|
498
|
-
return response
|
499
|
-
|
500
|
-
async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
|
501
|
-
server_name: str = None,
|
502
|
-
effective_time: datetime = None, for_lineage: bool = False,
|
503
|
-
for_duplicate_processing: bool = False,
|
504
|
-
start_from: int = 0, page_size: int = None) -> list:
|
505
|
-
if server_name is None:
|
506
|
-
server_name = self.server_name
|
507
|
-
if page_size is None:
|
508
|
-
page_size = self.page_size
|
509
|
-
|
510
|
-
validate_name(term)
|
511
|
-
|
512
|
-
for_lineage_s = str(for_lineage).lower()
|
513
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
514
|
-
|
515
|
-
body = {
|
516
|
-
"class": "GlossaryNameRequestBody",
|
517
|
-
"glossaryGUID": glossary_guid,
|
518
|
-
"name": term,
|
519
|
-
"effectiveTime": effective_time,
|
520
|
-
"limitResultsByStatus": status_filter
|
521
|
-
}
|
522
|
-
# body = body_slimmer(body)
|
523
|
-
|
524
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
525
|
-
f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
|
526
|
-
f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
|
527
|
-
|
528
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
529
|
-
|
530
|
-
response = await self._async_make_request("POST", url, body)
|
531
|
-
return response.json().get("elementList", "No terms found")
|
532
|
-
|
533
|
-
def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [], server_name: str = None,
|
534
|
-
effective_time: datetime = None, for_lineage: bool = False,
|
535
|
-
for_duplicate_processing: bool = False,
|
536
|
-
start_from: int = 0, page_size: int = None) -> list:
|
537
|
-
loop = asyncio.get_event_loop()
|
538
|
-
response = loop.run_until_complete(self._async_get_terms_by_name(term, glossary_guid, status_filter,
|
539
|
-
server_name, effective_time, for_lineage,
|
540
|
-
for_duplicate_processing, start_from, page_size))
|
541
|
-
return response
|
542
|
-
|
543
|
-
async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
544
|
-
effective_time: str = None, starts_with: bool = False,
|
545
|
-
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
546
|
-
for_duplicate_processing: bool = False, server_name: str = None,
|
547
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
548
|
-
|
549
|
-
""" Retrieve the list of glossary term metadata elements that contain the search string.
|
550
|
-
|
551
|
-
Parameters
|
552
|
-
----------
|
553
|
-
search_string: str
|
554
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
555
|
-
glossary_guid str
|
556
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
557
|
-
status_filter: list, default = [], optional
|
558
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
559
|
-
the results will not be filtered.
|
560
|
-
effective_time: str, [default=None], optional
|
561
|
-
Effective time of the query. If not specified will default to any time.
|
562
|
-
If the effective time is not in the right format then it will be considered any.
|
563
|
-
server_name : str, optional
|
564
|
-
The name of the server to configure.
|
565
|
-
If not provided, the server name associated with the instance is used.
|
566
|
-
starts_with : bool, [default=False], optional
|
567
|
-
Starts with the supplied string.
|
568
|
-
ends_with : bool, [default=False], optional
|
569
|
-
Ends with the supplied string
|
570
|
-
ignore_case : bool, [default=False], optional
|
571
|
-
Ignore case when searching
|
572
|
-
for_lineage : bool, [default=False], optional
|
573
|
-
|
574
|
-
for_duplicate_processing : bool, [default=False], optional
|
575
|
-
|
576
|
-
start_from: str, [default=0], optional
|
577
|
-
Page of results to start from
|
578
|
-
page_size : int, optional
|
579
|
-
Number of elements to return per page - if None, then default for class will be used.
|
580
|
-
|
581
|
-
Returns
|
582
|
-
-------
|
583
|
-
List | str
|
584
|
-
|
585
|
-
A list of term definitions
|
586
|
-
|
587
|
-
Raises
|
588
|
-
------
|
589
|
-
InvalidParameterException
|
590
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
591
|
-
PropertyServerException
|
592
|
-
Raised by the server when an issue arises in processing a valid request
|
593
|
-
NotAuthorizedException
|
594
|
-
The principle specified by the user_id does not have authorization for the requested action
|
595
|
-
|
596
|
-
Notes
|
597
|
-
-----
|
598
|
-
The search string is located in the request body and is interpreted as a plain string.
|
599
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
600
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
601
|
-
"""
|
602
|
-
if server_name is None:
|
603
|
-
server_name = self.server_name
|
604
|
-
if page_size is None:
|
605
|
-
page_size = self.page_size
|
606
|
-
if effective_time is None:
|
607
|
-
effective_time = datetime.now().isoformat()
|
608
|
-
starts_with_s = str(starts_with).lower()
|
609
|
-
ends_with_s = str(ends_with).lower()
|
610
|
-
ignore_case_s = str(ignore_case).lower()
|
611
|
-
for_lineage_s = str(for_lineage).lower()
|
612
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
613
|
-
if search_string == '*':
|
614
|
-
search_string = None
|
615
|
-
|
616
|
-
# validate_search_string(search_string)
|
617
|
-
|
618
|
-
body = {
|
619
|
-
"class": "GlossarySearchStringRequestBody",
|
620
|
-
"glossaryGUID": glossary_guid,
|
621
|
-
"searchString": search_string,
|
622
|
-
"effectiveTime": effective_time,
|
623
|
-
"limitResultsByStatus": status_filter
|
624
|
-
}
|
625
|
-
# body = body_slimmer(body)
|
626
|
-
|
627
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
628
|
-
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
629
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
630
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
631
|
-
|
632
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
633
|
-
|
634
|
-
response = await self._async_make_request("POST", url, body)
|
635
|
-
return response.json().get("elementList", "No terms found")
|
636
|
-
# return response.text
|
637
|
-
|
638
|
-
def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
639
|
-
effective_time: str = None, starts_with: bool = False,
|
640
|
-
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
641
|
-
for_duplicate_processing: bool = False, server_name: str = None,
|
642
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
643
|
-
|
644
|
-
loop = asyncio.get_event_loop()
|
645
|
-
response = loop.run_until_complete(self._async_find_glossary_terms(search_string, glossary_guid, status_filter,
|
646
|
-
effective_time, starts_with,
|
647
|
-
ends_with, ignore_case, for_lineage,
|
648
|
-
for_duplicate_processing, server_name,
|
649
|
-
start_from, page_size))
|
650
|
-
|
651
|
-
return response
|
652
|
-
|
653
|
-
#
|
654
|
-
# Catagories
|
655
|
-
#
|
656
|
-
|
657
|
-
#
|
658
|
-
# Feedback
|
659
|
-
#
|
660
|
-
async def _async_get_comment(self, commemtGUID: str, effective_time: datetime, server_name: str=None,
|
661
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict | list:
|
662
|
-
""" Retrieve the comment specified by the comment GUID """
|
663
|
-
if server_name is None:
|
664
|
-
server_name = self.server_name
|
665
|
-
|
666
|
-
validate_guid(commemtGUID)
|
667
|
-
|
668
|
-
if effective_time is None:
|
669
|
-
effective_time = datetime.now().isoformat()
|
670
|
-
|
671
|
-
for_lineage_s = str(for_lineage).lower()
|
672
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
673
|
-
|
674
|
-
body = {
|
675
|
-
"effective_time": effective_time
|
676
|
-
}
|
677
|
-
|
678
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
679
|
-
f"{commemtGUID}?forLineage={for_lineage_s}&"
|
680
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
681
|
-
|
682
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
683
|
-
|
684
|
-
response = await self._async_make_request("POST", url, body)
|
685
|
-
return response.json()
|
686
|
-
|
687
|
-
|
688
|
-
async def _async_add_comment_reply(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
689
|
-
server_name: str=None, for_lineage: bool = False,
|
690
|
-
for_duplicate_processing: bool = False ) -> str:
|
691
|
-
""" Reply to a comment """
|
692
|
-
|
693
|
-
if server_name is None:
|
694
|
-
server_name = self.server_name
|
695
|
-
|
696
|
-
validate_guid(commentGUID)
|
697
|
-
validate_name(comment_type)
|
698
|
-
|
699
|
-
is_public_s = str(is_public).lower()
|
700
|
-
for_lineage_s = str(for_lineage).lower()
|
701
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
702
|
-
|
703
|
-
body = {
|
704
|
-
"class": "CommentRequestBody",
|
705
|
-
"commentType": comment_type,
|
706
|
-
"commentText": comment_text,
|
707
|
-
"isPublic": is_public
|
708
|
-
}
|
709
|
-
|
710
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
711
|
-
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
712
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
713
|
-
|
714
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
715
|
-
|
716
|
-
response = await self._async_make_request("POST", url, body)
|
717
|
-
return response
|
718
|
-
|
719
|
-
|
720
|
-
async def _async_update_comment(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
721
|
-
server_name: str=None, is_merge_update: bool = False, for_lineage: bool = False,
|
722
|
-
for_duplicate_processing: bool = False) -> str:
|
723
|
-
""" Update the specified comment"""
|
724
|
-
if server_name is None:
|
725
|
-
server_name = self.server_name
|
726
|
-
|
727
|
-
validate_guid(commentGUID)
|
728
|
-
validate_name(comment_type)
|
729
|
-
|
730
|
-
is_public_s = str(is_public).lower()
|
731
|
-
for_lineage_s = str(for_lineage).lower()
|
732
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
733
|
-
|
734
|
-
body = {
|
735
|
-
"class": "CommentRequestBody",
|
736
|
-
"commentType": comment_type,
|
737
|
-
"commentText": comment_text,
|
738
|
-
"isPublic": is_public
|
739
|
-
}
|
740
|
-
|
741
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
742
|
-
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
743
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
744
|
-
|
745
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
746
|
-
|
747
|
-
response = await self._async_make_request("POST", url, body)
|
748
|
-
return response
|
749
|
-
|
750
|
-
async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
751
|
-
effective_time: str = None, starts_with: bool = False,
|
752
|
-
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
753
|
-
for_duplicate_processing: bool = False, server_name: str = None,
|
754
|
-
start_from: int = 0, page_size: int = None):
|
755
|
-
"""Find comments by search string"""
|
756
|
-
if server_name is None:
|
757
|
-
server_name = self.server_name
|
758
|
-
if page_size is None:
|
759
|
-
page_size = self.page_size
|
760
|
-
if effective_time is None:
|
761
|
-
effective_time = datetime.now().isoformat()
|
762
|
-
starts_with_s = str(starts_with).lower()
|
763
|
-
ends_with_s = str(ends_with).lower()
|
764
|
-
ignore_case_s = str(ignore_case).lower()
|
765
|
-
for_lineage_s = str(for_lineage).lower()
|
766
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
767
|
-
if search_string == '*':
|
768
|
-
search_string = None
|
769
|
-
|
770
|
-
# validate_search_string(search_string)
|
771
|
-
|
772
|
-
body = {
|
773
|
-
"class": "GlossarySearchStringRequestBody",
|
774
|
-
"glossaryGUID": glossary_guid,
|
775
|
-
"searchString": search_string,
|
776
|
-
"effectiveTime": effective_time,
|
777
|
-
"limitResultsByStatus": status_filter
|
778
|
-
}
|
779
|
-
# body = body_slimmer(body)
|
780
|
-
|
781
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
782
|
-
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
783
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
784
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
785
|
-
|
786
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
787
|
-
|
788
|
-
response = await self._async_make_request("POST", url, body)
|
789
|
-
return response.json().get("elementList", "No terms found")
|