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
@@ -0,0 +1,3002 @@
|
|
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_manager omvs module. There are additional methods that will be
|
6
|
+
added in subsequent versions of the glossary_omvs module.
|
7
|
+
|
8
|
+
"""
|
9
|
+
import asyncio
|
10
|
+
from datetime import datetime, time
|
11
|
+
|
12
|
+
# import json
|
13
|
+
from pyegeria._client import Client
|
14
|
+
from pyegeria._globals import enable_ssl_check
|
15
|
+
from pyegeria._validators import (validate_name, validate_guid, validate_search_string, )
|
16
|
+
from pyegeria.glossary_browser_omvs import GlossaryBrowser
|
17
|
+
from pyegeria.utils import body_slimmer
|
18
|
+
|
19
|
+
|
20
|
+
class GlossaryManager(GlossaryBrowser):
|
21
|
+
"""
|
22
|
+
GlossaryManager is a class that extends the Client class. It provides methods to create and manage glossaries,
|
23
|
+
terms and categories.
|
24
|
+
|
25
|
+
Attributes:
|
26
|
+
|
27
|
+
server_name: str
|
28
|
+
The name of the View Server to connect to.
|
29
|
+
platform_url : str
|
30
|
+
URL of the server platform to connect to
|
31
|
+
user_id : str
|
32
|
+
The identity of the user calling the method - this sets a default optionally used by the methods
|
33
|
+
when the user doesn't pass the user_id on a method call.
|
34
|
+
user_pwd: str
|
35
|
+
The password associated with the user_id. Defaults to None
|
36
|
+
verify_flag: bool
|
37
|
+
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
38
|
+
Defaults to False.
|
39
|
+
|
40
|
+
"""
|
41
|
+
|
42
|
+
def __init__(self, server_name: str, platform_url: str, token: str = None, user_id: str = None,
|
43
|
+
user_pwd: str = None, verify_flag: bool = enable_ssl_check, sync_mode: bool = True):
|
44
|
+
self.admin_command_root: str
|
45
|
+
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
|
46
|
+
|
47
|
+
#
|
48
|
+
# Get Valid Values for Enumerations
|
49
|
+
#
|
50
|
+
|
51
|
+
async def _async_create_glossary(self, display_name: str, description: str, server_name: str = None) -> str:
|
52
|
+
""" Create a new glossary. Async version.
|
53
|
+
|
54
|
+
Parameters
|
55
|
+
----------
|
56
|
+
display_name: str
|
57
|
+
The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
|
58
|
+
description: str
|
59
|
+
A description of the glossary.
|
60
|
+
server_name : str, optional
|
61
|
+
The name of the server to query. If not provided, the server name associated with the instance is used.
|
62
|
+
|
63
|
+
Returns
|
64
|
+
-------
|
65
|
+
str
|
66
|
+
The GUID of the created glossary.
|
67
|
+
|
68
|
+
"""
|
69
|
+
if server_name is None:
|
70
|
+
server_name = self.server_name
|
71
|
+
|
72
|
+
url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-manager/glossaries/"
|
73
|
+
body = {
|
74
|
+
"class": "ReferenceableRequestBody",
|
75
|
+
"elementProperties":
|
76
|
+
{
|
77
|
+
"class": "GlossaryProperties",
|
78
|
+
"qualifiedName": f"Glossary-{display_name}-{time.asctime()}",
|
79
|
+
"displayName": display_name,
|
80
|
+
"description": description
|
81
|
+
}
|
82
|
+
}
|
83
|
+
response = await self._async_make_request("POST", url, body)
|
84
|
+
return response.json().get("guid", None)
|
85
|
+
|
86
|
+
def create_glossary(self, display_name: str, description: str, server_name: str = None) -> str:
|
87
|
+
""" Create a new glossary.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
display_name: str
|
92
|
+
The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
|
93
|
+
description: str
|
94
|
+
A description of the glossary.
|
95
|
+
server_name : str, optional
|
96
|
+
The name of the server to query. If not provided, the server name associated with the instance is used.
|
97
|
+
|
98
|
+
Returns
|
99
|
+
-------
|
100
|
+
str
|
101
|
+
The GUID of the created glossary.
|
102
|
+
|
103
|
+
"""
|
104
|
+
loop = asyncio.get_event_loop()
|
105
|
+
response = loop.run_until_complete(self._async_create_glossary(display_name, description, server_name))
|
106
|
+
return response
|
107
|
+
|
108
|
+
async def _async_delete_glossary(self, glossary_guid: str, server_name: str = None) -> None:
|
109
|
+
""" Delete glossary. Async version.
|
110
|
+
|
111
|
+
Parameters
|
112
|
+
----------
|
113
|
+
glossary_guid: str
|
114
|
+
The ID of the glossary to delete.
|
115
|
+
server_name : str, optional
|
116
|
+
The name of the server to query. If not provided, the server name associated with the instance is used.
|
117
|
+
|
118
|
+
Returns
|
119
|
+
-------
|
120
|
+
None
|
121
|
+
|
122
|
+
"""
|
123
|
+
if server_name is None:
|
124
|
+
server_name = self.server_name
|
125
|
+
|
126
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-manager/glossaries/"
|
127
|
+
f"{glossary_guid}/remove")
|
128
|
+
|
129
|
+
await self._async_make_request("POST", url)
|
130
|
+
return
|
131
|
+
|
132
|
+
def delete_glossary(self, glossary_guid: str, server_name: str = None) -> None:
|
133
|
+
""" Create a new glossary.
|
134
|
+
|
135
|
+
Parameters
|
136
|
+
----------
|
137
|
+
glossary_guid: str
|
138
|
+
The ID of the glossary to delete.
|
139
|
+
server_name : str, optional
|
140
|
+
The name of the server to query. If not provided, the server name associated with the instance is used.
|
141
|
+
|
142
|
+
Returns
|
143
|
+
-------
|
144
|
+
None
|
145
|
+
|
146
|
+
"""
|
147
|
+
loop = asyncio.get_event_loop()
|
148
|
+
response = loop.run_until_complete(self._async_delete_glossary(glossary_guid, server_name))
|
149
|
+
return response
|
150
|
+
|
151
|
+
#
|
152
|
+
# Glossaries
|
153
|
+
#
|
154
|
+
|
155
|
+
async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
156
|
+
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
157
|
+
for_duplicate_processing: bool = False, type_name: str = None,
|
158
|
+
server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
|
159
|
+
""" Retrieve the list of glossary metadata elements that contain the search string. Async version.
|
160
|
+
The search string is located in the request body and is interpreted as a plain string.
|
161
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
162
|
+
|
163
|
+
Parameters
|
164
|
+
----------
|
165
|
+
search_string: str,
|
166
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
167
|
+
|
168
|
+
effective_time: str, [default=None], optional
|
169
|
+
Effective time of the query. If not specified will default to any time. Time format is
|
170
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
171
|
+
server_name : str, optional
|
172
|
+
The name of the server to configure.
|
173
|
+
If not provided, the server name associated with the instance is used.
|
174
|
+
starts_with : bool, [default=False], optional
|
175
|
+
Starts with the supplied string.
|
176
|
+
ends_with : bool, [default=False], optional
|
177
|
+
Ends with the supplied string
|
178
|
+
ignore_case : bool, [default=False], optional
|
179
|
+
Ignore case when searching
|
180
|
+
for_lineage : bool, [default=False], optional
|
181
|
+
|
182
|
+
for_duplicate_processing : bool, [default=False], optional
|
183
|
+
type_name: str, [default=None], optional
|
184
|
+
An optional parameter indicating the subtype of the glossary to filter by.
|
185
|
+
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
186
|
+
start_from: int, [default=0], optional
|
187
|
+
When multiple pages of results are available, the page number to start from.
|
188
|
+
page_size: int, [default=None]
|
189
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
190
|
+
the class instance.
|
191
|
+
Returns
|
192
|
+
-------
|
193
|
+
List | str
|
194
|
+
|
195
|
+
A list of glossary definitions active in the server.
|
196
|
+
|
197
|
+
Raises
|
198
|
+
------
|
199
|
+
|
200
|
+
InvalidParameterException
|
201
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
202
|
+
PropertyServerException
|
203
|
+
Raised by the server when an issue arises in processing a valid request
|
204
|
+
NotAuthorizedException
|
205
|
+
The principle specified by the user_id does not have authorization for the requested action
|
206
|
+
|
207
|
+
"""
|
208
|
+
if server_name is None:
|
209
|
+
server_name = self.server_name
|
210
|
+
if page_size is None:
|
211
|
+
page_size = self.page_size
|
212
|
+
starts_with_s = str(starts_with).lower()
|
213
|
+
ends_with_s = str(ends_with).lower()
|
214
|
+
ignore_case_s = str(ignore_case).lower()
|
215
|
+
for_lineage_s = str(for_lineage).lower()
|
216
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
217
|
+
|
218
|
+
validate_search_string(search_string)
|
219
|
+
|
220
|
+
if search_string == '*':
|
221
|
+
search_string = None
|
222
|
+
|
223
|
+
body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time,
|
224
|
+
"typeName": type_name}
|
225
|
+
body = body_slimmer(body)
|
226
|
+
# print(f"\n\nBody is: \n{body}")
|
227
|
+
|
228
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
229
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
230
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
231
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
232
|
+
|
233
|
+
response = await self._async_make_request("POST", url, body)
|
234
|
+
return response.json().get("elementList", "No Glossaries found")
|
235
|
+
|
236
|
+
def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
237
|
+
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
238
|
+
for_duplicate_processing: bool = False, type_name: str = None, server_name: str = None,
|
239
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
240
|
+
""" Retrieve the list of glossary metadata elements that contain the search string.
|
241
|
+
The search string is located in the request body and is interpreted as a plain string.
|
242
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
243
|
+
|
244
|
+
Parameters
|
245
|
+
----------
|
246
|
+
search_string: str,
|
247
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
248
|
+
|
249
|
+
effective_time: str, [default=None], optional
|
250
|
+
Effective time of the query. If not specified will default to any time. Time format is
|
251
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
252
|
+
server_name : str, optional
|
253
|
+
The name of the server to configure.
|
254
|
+
If not provided, the server name associated with the instance is used.
|
255
|
+
starts_with : bool, [default=False], optional
|
256
|
+
Starts with the supplied string.
|
257
|
+
ends_with : bool, [default=False], optional
|
258
|
+
Ends with the supplied string
|
259
|
+
ignore_case : bool, [default=False], optional
|
260
|
+
Ignore case when searching
|
261
|
+
for_lineage : bool, [default=False], optional
|
262
|
+
Indicates the search is for lineage.
|
263
|
+
for_duplicate_processing : bool, [default=False], optional
|
264
|
+
type_name: str, [default=None], optional
|
265
|
+
An optional parameter indicating the subtype of the glossary to filter by.
|
266
|
+
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
267
|
+
start_from: int, [default=0], optional
|
268
|
+
When multiple pages of results are available, the page number to start from.
|
269
|
+
page_size: int, [default=None]
|
270
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
271
|
+
the class instance.
|
272
|
+
Returns
|
273
|
+
-------
|
274
|
+
List | str
|
275
|
+
|
276
|
+
A list of glossary definitions active in the server.
|
277
|
+
|
278
|
+
Raises
|
279
|
+
------
|
280
|
+
|
281
|
+
InvalidParameterException
|
282
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
283
|
+
PropertyServerException
|
284
|
+
Raised by the server when an issue arises in processing a valid request
|
285
|
+
NotAuthorizedException
|
286
|
+
The principle specified by the user_id does not have authorization for the requested action
|
287
|
+
|
288
|
+
"""
|
289
|
+
loop = asyncio.get_event_loop()
|
290
|
+
response = loop.run_until_complete(
|
291
|
+
self._async_find_glossaries(search_string, effective_time, starts_with, ends_with, ignore_case, for_lineage,
|
292
|
+
for_duplicate_processing, type_name, server_name, start_from, page_size))
|
293
|
+
|
294
|
+
return response
|
295
|
+
|
296
|
+
async def _async_get_glossary_by_guid(self, glossary_guid: str, server_name: str = None,
|
297
|
+
effective_time: str = None) -> dict:
|
298
|
+
""" Retrieves information about a glossary
|
299
|
+
Parameters
|
300
|
+
----------
|
301
|
+
glossary_guid : str
|
302
|
+
Unique idetifier for the glossary
|
303
|
+
server_name : str, optional
|
304
|
+
The name of the server to get the configured access services for.
|
305
|
+
If not provided, the server name associated with the instance is used.
|
306
|
+
effective_time: str, optional
|
307
|
+
Effective time of the query. If not specified will default to any time. Time format is
|
308
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
309
|
+
Returns
|
310
|
+
-------
|
311
|
+
dict
|
312
|
+
The glossary definition associated with the glossary_guid
|
313
|
+
|
314
|
+
Raises
|
315
|
+
------
|
316
|
+
InvalidParameterException
|
317
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
318
|
+
PropertyServerException
|
319
|
+
Raised by the server when an issue arises in processing a valid request.
|
320
|
+
NotAuthorizedException
|
321
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
322
|
+
Notes
|
323
|
+
-----
|
324
|
+
"""
|
325
|
+
if server_name is None:
|
326
|
+
server_name = self.server_name
|
327
|
+
validate_guid(glossary_guid)
|
328
|
+
|
329
|
+
body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
|
330
|
+
|
331
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
332
|
+
f"{glossary_guid}/retrieve")
|
333
|
+
print(url)
|
334
|
+
response = await self._async_make_request("POST", url, payload=body)
|
335
|
+
return response.json()
|
336
|
+
|
337
|
+
def get_glossary_by_guid(self, glossary_guid: str, server_name: str = None) -> dict:
|
338
|
+
""" Retrieves information about a glossary
|
339
|
+
Parameters
|
340
|
+
----------
|
341
|
+
glossary_guid : str
|
342
|
+
Unique idetifier for the glossary
|
343
|
+
server_name : str, optional
|
344
|
+
The name of the server to get the configured access services for.
|
345
|
+
If not provided, the server name associated with the instance is used.
|
346
|
+
Returns
|
347
|
+
-------
|
348
|
+
dict
|
349
|
+
The glossary definition associated with the glossary_guid
|
350
|
+
|
351
|
+
Raises
|
352
|
+
------
|
353
|
+
InvalidParameterException
|
354
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
355
|
+
PropertyServerException
|
356
|
+
Raised by the server when an issue arises in processing a valid request.
|
357
|
+
NotAuthorizedException
|
358
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
359
|
+
Notes
|
360
|
+
-----
|
361
|
+
"""
|
362
|
+
loop = asyncio.get_event_loop()
|
363
|
+
response = loop.run_until_complete(self._async_get_glossary_by_guid(glossary_guid, server_name))
|
364
|
+
return response
|
365
|
+
|
366
|
+
async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: str = None,
|
367
|
+
server_name: str = None, start_from: int = 0,
|
368
|
+
page_size: int = None) -> dict | str:
|
369
|
+
""" Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
370
|
+
There are no wildcards supported on this request.
|
371
|
+
|
372
|
+
Parameters
|
373
|
+
----------
|
374
|
+
glossary_name: str,
|
375
|
+
Name of the glossary to be retrieved
|
376
|
+
effective_time: datetime, [default=None], optional
|
377
|
+
Effective time of the query. If not specified will default to any effective time. Time format is
|
378
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
379
|
+
server_name : str, optional
|
380
|
+
The name of the server to configure.
|
381
|
+
If not provided, the server name associated with the instance is used.
|
382
|
+
start_from: int, [default=0], optional
|
383
|
+
When multiple pages of results are available, the page number to start from.
|
384
|
+
page_size: int, [default=None]
|
385
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
386
|
+
the class instance.
|
387
|
+
|
388
|
+
Returns
|
389
|
+
-------
|
390
|
+
None
|
391
|
+
|
392
|
+
Raises
|
393
|
+
------
|
394
|
+
|
395
|
+
InvalidParameterException
|
396
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
397
|
+
PropertyServerException
|
398
|
+
Raised by the server when an issue arises in processing a valid request
|
399
|
+
NotAuthorizedException
|
400
|
+
The principle specified by the user_id does not have authorization for the requested action
|
401
|
+
ConfigurationErrorException
|
402
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
403
|
+
invalid or make the new call invalid.
|
404
|
+
"""
|
405
|
+
if server_name is None:
|
406
|
+
server_name = self.server_name
|
407
|
+
if page_size is None:
|
408
|
+
page_size = self.page_size
|
409
|
+
validate_name(glossary_name)
|
410
|
+
|
411
|
+
if effective_time is None:
|
412
|
+
body = {"name": glossary_name}
|
413
|
+
else:
|
414
|
+
body = {"name": glossary_name, "effectiveTime": effective_time}
|
415
|
+
|
416
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
417
|
+
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
418
|
+
|
419
|
+
response = await self._async_make_request("POST", url, body)
|
420
|
+
return response.json()
|
421
|
+
|
422
|
+
def get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, server_name: str = None,
|
423
|
+
start_from: int = 0, page_size: int = None) -> dict | str:
|
424
|
+
""" Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
425
|
+
There are no wildcards supported on this request.
|
426
|
+
|
427
|
+
Parameters
|
428
|
+
----------
|
429
|
+
glossary_name: str,
|
430
|
+
Name of the glossary to be retrieved
|
431
|
+
effective_time: datetime, [default=None], optional
|
432
|
+
Effective time of the query. If not specified will default to any effective time.
|
433
|
+
server_name : str, optional
|
434
|
+
The name of the server to configure.
|
435
|
+
If not provided, the server name associated with the instance is used.
|
436
|
+
start_from: int, [default=0], optional
|
437
|
+
When multiple pages of results are available, the page number to start from.
|
438
|
+
page_size: int, [default=None]
|
439
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
440
|
+
he class instance.
|
441
|
+
|
442
|
+
Returns
|
443
|
+
-------
|
444
|
+
None
|
445
|
+
|
446
|
+
Raises
|
447
|
+
------
|
448
|
+
InvalidParameterException
|
449
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
450
|
+
PropertyServerException
|
451
|
+
Raised by the server when an issue arises in processing a valid request
|
452
|
+
NotAuthorizedException
|
453
|
+
The principle specified by the user_id does not have authorization for the requested action
|
454
|
+
ConfigurationErrorException
|
455
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
456
|
+
invalid or make the new call invalid.
|
457
|
+
"""
|
458
|
+
loop = asyncio.get_event_loop()
|
459
|
+
response = loop.run_until_complete(
|
460
|
+
self._async_get_glossaries_by_name(glossary_name, effective_time, server_name, start_from, page_size))
|
461
|
+
return response
|
462
|
+
|
463
|
+
#
|
464
|
+
# Glossary Categories
|
465
|
+
#
|
466
|
+
async def _async_create_category(self, glossary_guid: str, display_name: str, description: str,
|
467
|
+
server_name: str = None) -> str:
|
468
|
+
""" Create a new category within the specified glossary. Async Version.
|
469
|
+
|
470
|
+
Parameters
|
471
|
+
----------
|
472
|
+
glossary_guid: str,
|
473
|
+
Unique identifier for the glossary.
|
474
|
+
display_name: str,
|
475
|
+
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
476
|
+
description: str,
|
477
|
+
Description for the category.
|
478
|
+
server_name : str, optional
|
479
|
+
The name of the server to configure.
|
480
|
+
If not provided, the server name associated with the instance is used.
|
481
|
+
|
482
|
+
Returns
|
483
|
+
-------
|
484
|
+
A string with the GUID of the new category..
|
485
|
+
|
486
|
+
Raises
|
487
|
+
------
|
488
|
+
|
489
|
+
InvalidParameterException
|
490
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
491
|
+
PropertyServerException
|
492
|
+
Raised by the server when an issue arises in processing a valid request
|
493
|
+
NotAuthorizedException
|
494
|
+
The principle specified by the user_id does not have authorization for the requested action
|
495
|
+
ConfigurationErrorException
|
496
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
497
|
+
invalid or make the new call invalid.
|
498
|
+
"""
|
499
|
+
if server_name is None:
|
500
|
+
server_name = self.server_name
|
501
|
+
|
502
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
503
|
+
f"{glossary_guid}/categories")
|
504
|
+
body = {
|
505
|
+
"class": "ReferenceableRequestBody",
|
506
|
+
"elementProperties":
|
507
|
+
{
|
508
|
+
"class": "GlossaryCategoryProperties",
|
509
|
+
"qualifiedName": f"GlossaryCategory-{display_name}-{time.asctime()}",
|
510
|
+
"displayName": display_name,
|
511
|
+
"description": description
|
512
|
+
}
|
513
|
+
}
|
514
|
+
response = await self._async_make_request("POST", url, body)
|
515
|
+
return response.json().get("guid", None)
|
516
|
+
|
517
|
+
def create_category(self, glossary_guid: str, display_name: str, description: str,
|
518
|
+
server_name: str = None) -> str:
|
519
|
+
""" Create a new category within the specified glossary.
|
520
|
+
|
521
|
+
Parameters
|
522
|
+
----------
|
523
|
+
glossary_guid: str,
|
524
|
+
Unique identifier for the glossary.
|
525
|
+
display_name: str,
|
526
|
+
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
527
|
+
description: str,
|
528
|
+
Description for the category.
|
529
|
+
server_name : str, optional
|
530
|
+
The name of the server to configure.
|
531
|
+
If not provided, the server name associated with the instance is used.
|
532
|
+
|
533
|
+
Returns
|
534
|
+
-------
|
535
|
+
A string with the GUID of the new category..
|
536
|
+
|
537
|
+
Raises
|
538
|
+
------
|
539
|
+
|
540
|
+
InvalidParameterException
|
541
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
542
|
+
PropertyServerException
|
543
|
+
Raised by the server when an issue arises in processing a valid request
|
544
|
+
NotAuthorizedException
|
545
|
+
The principle specified by the user_id does not have authorization for the requested action
|
546
|
+
ConfigurationErrorException
|
547
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
548
|
+
invalid or make the new call invalid.
|
549
|
+
"""
|
550
|
+
loop = asyncio.get_event_loop()
|
551
|
+
response = loop.run_until_complete(
|
552
|
+
self._async_create_category(glossary_guid, display_name, description, server_name))
|
553
|
+
return response
|
554
|
+
|
555
|
+
async def _async_get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
|
556
|
+
server_name: str = None) -> dict | str:
|
557
|
+
""" Retrieve the glossary metadata element for the requested category. The optional request body allows you to
|
558
|
+
specify that the glossary element should only be returned if it was effective at a particular time.
|
559
|
+
|
560
|
+
Parameters
|
561
|
+
----------
|
562
|
+
glossary_category_guid: str,
|
563
|
+
Unique identifier for the glossary category.
|
564
|
+
effective_time: datetime, [default=None], optional
|
565
|
+
Effective time of the query. If not specified will default to any effective time. Time format is
|
566
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
567
|
+
server_name : str, optional
|
568
|
+
The name of the server to configure.
|
569
|
+
If not provided, the server name associated with the instance is used.
|
570
|
+
|
571
|
+
Returns
|
572
|
+
-------
|
573
|
+
A dict structure with the glossary metadata element for the requested category.
|
574
|
+
|
575
|
+
Raises
|
576
|
+
------
|
577
|
+
|
578
|
+
InvalidParameterException
|
579
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
580
|
+
PropertyServerException
|
581
|
+
Raised by the server when an issue arises in processing a valid request
|
582
|
+
NotAuthorizedException
|
583
|
+
The principle specified by the user_id does not have authorization for the requested action
|
584
|
+
ConfigurationErrorException
|
585
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
586
|
+
invalid or make the new call invalid.
|
587
|
+
"""
|
588
|
+
if server_name is None:
|
589
|
+
server_name = self.server_name
|
590
|
+
|
591
|
+
body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
|
592
|
+
|
593
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
594
|
+
f"for-category/{glossary_category_guid}/retrieve")
|
595
|
+
|
596
|
+
response = await self._async_make_request("POST", url, body)
|
597
|
+
return response.json()
|
598
|
+
|
599
|
+
def get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
|
600
|
+
server_name: str = None) -> dict | str:
|
601
|
+
""" Retrieve the glossary metadata element for the requested category. The optional request body allows you to
|
602
|
+
specify that the glossary element should only be returned if it was effective at a particular time.
|
603
|
+
|
604
|
+
Parameters
|
605
|
+
----------
|
606
|
+
glossary_category_guid: str,
|
607
|
+
Unique identifier for the glossary category.
|
608
|
+
effective_time: datetime, [default=None], optional
|
609
|
+
Effective time of the query. If not specified will default to any effective time. Time format is
|
610
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
611
|
+
server_name : str, optional
|
612
|
+
The name of the server to configure.
|
613
|
+
If not provided, the server name associated with the instance is used.
|
614
|
+
|
615
|
+
Returns
|
616
|
+
-------
|
617
|
+
A dict structure with the glossary metadata element for the requested category.
|
618
|
+
|
619
|
+
Raises
|
620
|
+
------
|
621
|
+
|
622
|
+
InvalidParameterException
|
623
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
624
|
+
PropertyServerException
|
625
|
+
Raised by the server when an issue arises in processing a valid request
|
626
|
+
NotAuthorizedException
|
627
|
+
The principle specified by the user_id does not have authorization for the requested action
|
628
|
+
ConfigurationErrorException
|
629
|
+
Raised when configuration parameters passed on earlier calls turn out to be
|
630
|
+
invalid or make the new call invalid.
|
631
|
+
"""
|
632
|
+
loop = asyncio.get_event_loop()
|
633
|
+
response = loop.run_until_complete(
|
634
|
+
self._async_get_glossary_fpr_category(glossary_category_guid, effective_time, server_name))
|
635
|
+
return response
|
636
|
+
|
637
|
+
async def _async_find_glossary_categories(self, search_string: str, effective_time: str = None,
|
638
|
+
starts_with: bool = False, ends_with: bool = False,
|
639
|
+
ignore_case: bool = False, server_name: str = None, start_from: int = 0,
|
640
|
+
page_size: int = None) -> list | str:
|
641
|
+
""" Retrieve the list of glossary category metadata elements that contain the search string.
|
642
|
+
The search string is located in the request body and is interpreted as a plain string.
|
643
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
644
|
+
Async version.
|
645
|
+
|
646
|
+
Parameters
|
647
|
+
----------
|
648
|
+
search_string: str,
|
649
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
650
|
+
|
651
|
+
effective_time: str, [default=None], optional
|
652
|
+
Effective time of the query. If not specified will default to any time. Time format is
|
653
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
654
|
+
server_name : str, optional
|
655
|
+
The name of the server to configure.
|
656
|
+
If not provided, the server name associated with the instance is used.
|
657
|
+
starts_with : bool, [default=False], optional
|
658
|
+
Starts with the supplied string.
|
659
|
+
ends_with : bool, [default=False], optional
|
660
|
+
Ends with the supplied string
|
661
|
+
ignore_case : bool, [default=False], optional
|
662
|
+
Ignore case when searching
|
663
|
+
start_from: int, [default=0], optional
|
664
|
+
When multiple pages of results are available, the page number to start from.
|
665
|
+
page_size: int, [default=None]
|
666
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
667
|
+
the class instance.
|
668
|
+
Returns
|
669
|
+
-------
|
670
|
+
List | str
|
671
|
+
|
672
|
+
A list of glossary definitions active in the server.
|
673
|
+
|
674
|
+
Raises
|
675
|
+
------
|
676
|
+
|
677
|
+
InvalidParameterException
|
678
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
679
|
+
PropertyServerException
|
680
|
+
Raised by the server when an issue arises in processing a valid request
|
681
|
+
NotAuthorizedException
|
682
|
+
The principle specified by the user_id does not have authorization for the requested action
|
683
|
+
|
684
|
+
"""
|
685
|
+
if server_name is None:
|
686
|
+
server_name = self.server_name
|
687
|
+
if page_size is None:
|
688
|
+
page_size = self.page_size
|
689
|
+
starts_with_s = str(starts_with).lower()
|
690
|
+
ends_with_s = str(ends_with).lower()
|
691
|
+
ignore_case_s = str(ignore_case).lower()
|
692
|
+
|
693
|
+
validate_search_string(search_string)
|
694
|
+
|
695
|
+
if search_string == '*':
|
696
|
+
search_string = None
|
697
|
+
|
698
|
+
body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time}
|
699
|
+
body = body_slimmer(body)
|
700
|
+
|
701
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
702
|
+
f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
703
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
|
704
|
+
|
705
|
+
response = await self._async_make_request("POST", url, body)
|
706
|
+
return response.json().get("elementList", "No Categories found")
|
707
|
+
|
708
|
+
def find_glossary_categories(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
709
|
+
ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
|
710
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
711
|
+
""" Retrieve the list of glossary category metadata elements that contain the search string.
|
712
|
+
The search string is located in the request body and is interpreted as a plain string.
|
713
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
714
|
+
|
715
|
+
Parameters
|
716
|
+
----------
|
717
|
+
search_string: str,
|
718
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
719
|
+
|
720
|
+
effective_time: str, [default=None], optional
|
721
|
+
Effective time of the query. If not specified will default to any time. Time format is
|
722
|
+
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
723
|
+
server_name : str, optional
|
724
|
+
The name of the server to configure.
|
725
|
+
If not provided, the server name associated with the instance is used.
|
726
|
+
starts_with : bool, [default=False], optional
|
727
|
+
Starts with the supplied string.
|
728
|
+
ends_with : bool, [default=False], optional
|
729
|
+
Ends with the supplied string
|
730
|
+
ignore_case : bool, [default=False], optional
|
731
|
+
Ignore case when searching
|
732
|
+
start_from: int, [default=0], optional
|
733
|
+
When multiple pages of results are available, the page number to start from.
|
734
|
+
page_size: int, [default=None]
|
735
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
736
|
+
the class instance.
|
737
|
+
Returns
|
738
|
+
-------
|
739
|
+
List | str
|
740
|
+
|
741
|
+
A list of glossary definitions active in the server.
|
742
|
+
|
743
|
+
Raises
|
744
|
+
------
|
745
|
+
|
746
|
+
InvalidParameterException
|
747
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
748
|
+
PropertyServerException
|
749
|
+
Raised by the server when an issue arises in processing a valid request
|
750
|
+
NotAuthorizedException
|
751
|
+
The principle specified by the user_id does not have authorization for the requested action
|
752
|
+
|
753
|
+
"""
|
754
|
+
loop = asyncio.get_event_loop()
|
755
|
+
response = loop.run_until_complete(
|
756
|
+
self._async_find_glossary_categories(search_string, effective_time, starts_with, ends_with, ignore_case,
|
757
|
+
server_name, start_from, page_size))
|
758
|
+
|
759
|
+
return response
|
760
|
+
|
761
|
+
async def _async_get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
|
762
|
+
page_size: int = None) -> list | str:
|
763
|
+
""" Return the list of categories associated with a glossary.
|
764
|
+
Async version.
|
765
|
+
|
766
|
+
Parameters
|
767
|
+
----------
|
768
|
+
glossary_guid: str,
|
769
|
+
Unique identity of the glossary
|
770
|
+
server_name : str, optional
|
771
|
+
The name of the server to configure.
|
772
|
+
If not provided, the server name associated with the instance is used.
|
773
|
+
start_from: int, [default=0], optional
|
774
|
+
When multiple pages of results are available, the page number to start from.
|
775
|
+
page_size: int, [default=None]
|
776
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
777
|
+
the class instance.
|
778
|
+
Returns
|
779
|
+
-------
|
780
|
+
List | str
|
781
|
+
|
782
|
+
A list of categories associated with a glossary.
|
783
|
+
|
784
|
+
Raises
|
785
|
+
------
|
786
|
+
|
787
|
+
InvalidParameterException
|
788
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
789
|
+
PropertyServerException
|
790
|
+
Raised by the server when an issue arises in processing a valid request
|
791
|
+
NotAuthorizedException
|
792
|
+
The principle specified by the user_id does not have authorization for the requested action
|
793
|
+
|
794
|
+
"""
|
795
|
+
if server_name is None:
|
796
|
+
server_name = self.server_name
|
797
|
+
if page_size is None:
|
798
|
+
page_size = self.page_size
|
799
|
+
|
800
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
801
|
+
f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
|
802
|
+
|
803
|
+
response = await self._async_make_request("POST", url)
|
804
|
+
return response.json().get("elementList", "No Categories found")
|
805
|
+
|
806
|
+
def get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
|
807
|
+
page_size: int = None) -> list | str:
|
808
|
+
""" Return the list of categories associated with a glossary.
|
809
|
+
|
810
|
+
Parameters
|
811
|
+
----------
|
812
|
+
glossary_guid: str,
|
813
|
+
Unique identity of the glossary
|
814
|
+
server_name : str, optional
|
815
|
+
The name of the server to configure.
|
816
|
+
If not provided, the server name associated with the instance is used.
|
817
|
+
start_from: int, [default=0], optional
|
818
|
+
When multiple pages of results are available, the page number to start from.
|
819
|
+
page_size: int, [default=None]
|
820
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
821
|
+
the class instance.
|
822
|
+
Returns
|
823
|
+
-------
|
824
|
+
List | str
|
825
|
+
|
826
|
+
A list of categories associated with a glossary.
|
827
|
+
|
828
|
+
Raises
|
829
|
+
------
|
830
|
+
|
831
|
+
InvalidParameterException
|
832
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
833
|
+
PropertyServerException
|
834
|
+
Raised by the server when an issue arises in processing a valid request
|
835
|
+
NotAuthorizedException
|
836
|
+
The principle specified by the user_id does not have authorization for the requested action
|
837
|
+
|
838
|
+
"""
|
839
|
+
loop = asyncio.get_event_loop()
|
840
|
+
response = loop.run_until_complete(
|
841
|
+
self._async_get_categories_for_glossary(glossary_guid, server_name, start_from, page_size))
|
842
|
+
return response
|
843
|
+
|
844
|
+
async def _async_get_categories_for_term(self, glossary_term_guid: str, server_name: str = None,
|
845
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
846
|
+
""" Return the list of categories associated with a glossary term.
|
847
|
+
Async version.
|
848
|
+
|
849
|
+
Parameters
|
850
|
+
----------
|
851
|
+
glossary_term_guid: str,
|
852
|
+
Unique identity of a glossary term
|
853
|
+
server_name : str, optional
|
854
|
+
The name of the server to use.
|
855
|
+
If not provided, the server name associated with the instance is used.
|
856
|
+
start_from: int, [default=0], optional
|
857
|
+
When multiple pages of results are available, the page number to start from.
|
858
|
+
page_size: int, [default=None]
|
859
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
860
|
+
the class instance.
|
861
|
+
Returns
|
862
|
+
-------
|
863
|
+
List | str
|
864
|
+
|
865
|
+
A list of categories associated with a glossary term.
|
866
|
+
|
867
|
+
Raises
|
868
|
+
------
|
869
|
+
|
870
|
+
InvalidParameterException
|
871
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
872
|
+
PropertyServerException
|
873
|
+
Raised by the server when an issue arises in processing a valid request
|
874
|
+
NotAuthorizedException
|
875
|
+
The principle specified by the user_id does not have authorization for the requested action
|
876
|
+
|
877
|
+
"""
|
878
|
+
if server_name is None:
|
879
|
+
server_name = self.server_name
|
880
|
+
if page_size is None:
|
881
|
+
page_size = self.page_size
|
882
|
+
|
883
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
|
884
|
+
f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
|
885
|
+
|
886
|
+
response = await self._async_make_request("POST", url)
|
887
|
+
return response.json().get("elementList", "No Categories found")
|
888
|
+
|
889
|
+
def get_categories_for_term(self, glossary_term_guid: str, server_name: str = None, start_from: int = 0,
|
890
|
+
page_size: int = None) -> list | str:
|
891
|
+
""" Return the list of categories associated with a glossary term.
|
892
|
+
|
893
|
+
Parameters
|
894
|
+
----------
|
895
|
+
glossary_term_guid: str,
|
896
|
+
Unique identity of a glossary term
|
897
|
+
server_name : str, optional
|
898
|
+
The name of the server to use.
|
899
|
+
If not provided, the server name associated with the instance is used.
|
900
|
+
start_from: int, [default=0], optional
|
901
|
+
When multiple pages of results are available, the page number to start from.
|
902
|
+
page_size: int, [default=None]
|
903
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
904
|
+
the class instance.
|
905
|
+
Returns
|
906
|
+
-------
|
907
|
+
List | str
|
908
|
+
|
909
|
+
A list of categories associated with a glossary term.
|
910
|
+
|
911
|
+
Raises
|
912
|
+
------
|
913
|
+
|
914
|
+
InvalidParameterException
|
915
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
916
|
+
PropertyServerException
|
917
|
+
Raised by the server when an issue arises in processing a valid request
|
918
|
+
NotAuthorizedException
|
919
|
+
The principle specified by the user_id does not have authorization for the requested action
|
920
|
+
|
921
|
+
"""
|
922
|
+
loop = asyncio.get_event_loop()
|
923
|
+
response = loop.run_until_complete(
|
924
|
+
self._async_get_categories_for_term(glossary_term_guid, server_name, start_from, page_size))
|
925
|
+
return response
|
926
|
+
|
927
|
+
async def _async_get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
|
928
|
+
server_name: str = None, start_from: int = 0,
|
929
|
+
page_size: int = None) -> list | str:
|
930
|
+
""" Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
|
931
|
+
The name to search for is located in the request body and is interpreted as a plain string.
|
932
|
+
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
933
|
+
|
934
|
+
Async version.
|
935
|
+
|
936
|
+
Parameters
|
937
|
+
----------
|
938
|
+
name: str,
|
939
|
+
category name to search for.
|
940
|
+
glossary_guid: str, optional
|
941
|
+
The identity of the glossary to search. If not specified, all glossaries will be searched.
|
942
|
+
status: [str], optional
|
943
|
+
A list of statuses to optionally restrict results. Default is Active
|
944
|
+
server_name : str, optional
|
945
|
+
The name of the server to configure.
|
946
|
+
If not provided, the server name associated with the instance is used.
|
947
|
+
start_from: int, [default=0], optional
|
948
|
+
When multiple pages of results are available, the page number to start from.
|
949
|
+
page_size: int, [default=None]
|
950
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
951
|
+
the class instance.
|
952
|
+
Returns
|
953
|
+
-------
|
954
|
+
List | str
|
955
|
+
|
956
|
+
A list of categories with the corresponding display name or qualified name.
|
957
|
+
|
958
|
+
Raises
|
959
|
+
------
|
960
|
+
|
961
|
+
InvalidParameterException
|
962
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
963
|
+
PropertyServerException
|
964
|
+
Raised by the server when an issue arises in processing a valid request
|
965
|
+
NotAuthorizedException
|
966
|
+
The principle specified by the user_id does not have authorization for the requested action
|
967
|
+
|
968
|
+
"""
|
969
|
+
if server_name is None:
|
970
|
+
server_name = self.server_name
|
971
|
+
if page_size is None:
|
972
|
+
page_size = self.page_size
|
973
|
+
validate_name(name)
|
974
|
+
|
975
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
|
976
|
+
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
977
|
+
|
978
|
+
body = {"class": "GlossaryNameRequestBody", "name": name, "glossaryGUID": glossary_guid,
|
979
|
+
"limitResultsByStatus": status}
|
980
|
+
|
981
|
+
response = await self._async_make_request("POST", url)
|
982
|
+
return response.json().get("elementList", "No Categories found")
|
983
|
+
|
984
|
+
def get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
|
985
|
+
server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
|
986
|
+
""" Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
|
987
|
+
The name to search for is located in the request body and is interpreted as a plain string.
|
988
|
+
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
989
|
+
|
990
|
+
Parameters
|
991
|
+
----------
|
992
|
+
name: str,
|
993
|
+
category name to search for.
|
994
|
+
glossary_guid: str, optional
|
995
|
+
The identity of the glossary to search. If not specified, all glossaries will be searched.
|
996
|
+
status: [str], optional
|
997
|
+
A list of statuses to optionally restrict results. Default is Active
|
998
|
+
server_name : str, optional
|
999
|
+
The name of the server to configure.
|
1000
|
+
If not provided, the server name associated with the instance is used.
|
1001
|
+
start_from: int, [default=0], optional
|
1002
|
+
When multiple pages of results are available, the page number to start from.
|
1003
|
+
page_size: int, [default=None]
|
1004
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
1005
|
+
the class instance.
|
1006
|
+
Returns
|
1007
|
+
-------
|
1008
|
+
List | str
|
1009
|
+
|
1010
|
+
A list of categories with the corresponding display name or qualified name.
|
1011
|
+
|
1012
|
+
Raises
|
1013
|
+
------
|
1014
|
+
|
1015
|
+
InvalidParameterException
|
1016
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1017
|
+
PropertyServerException
|
1018
|
+
Raised by the server when an issue arises in processing a valid request
|
1019
|
+
NotAuthorizedException
|
1020
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1021
|
+
|
1022
|
+
"""
|
1023
|
+
loop = asyncio.get_event_loop()
|
1024
|
+
response = loop.run_until_complete(
|
1025
|
+
self._async_get_categories_by_name(name, glossary_guid, status, server_name, start_from, page_size))
|
1026
|
+
return response
|
1027
|
+
|
1028
|
+
async def _async_get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
|
1029
|
+
server_name: str = None) -> list | str:
|
1030
|
+
""" Retrieve the requested glossary category metadata element. The optional request body contain an effective
|
1031
|
+
time for the query..
|
1032
|
+
|
1033
|
+
Async version.
|
1034
|
+
|
1035
|
+
Parameters
|
1036
|
+
----------
|
1037
|
+
glossary_category_guid: str
|
1038
|
+
The identity of the glossary category to search.
|
1039
|
+
effective_time, datetime, optional
|
1040
|
+
If specified, the category should only be returned if it was effective at the specified time.
|
1041
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1042
|
+
server_name : str, optional
|
1043
|
+
The name of the server to configure.
|
1044
|
+
If not provided, the server name associated with the instance is used.
|
1045
|
+
|
1046
|
+
Returns
|
1047
|
+
-------
|
1048
|
+
List | str
|
1049
|
+
|
1050
|
+
Details for the category with the glossary category GUID.
|
1051
|
+
|
1052
|
+
Raises
|
1053
|
+
------
|
1054
|
+
|
1055
|
+
InvalidParameterException
|
1056
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1057
|
+
PropertyServerException
|
1058
|
+
Raised by the server when an issue arises in processing a valid request
|
1059
|
+
NotAuthorizedException
|
1060
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1061
|
+
|
1062
|
+
"""
|
1063
|
+
if server_name is None:
|
1064
|
+
server_name = self.server_name
|
1065
|
+
|
1066
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
|
1067
|
+
f"{glossary_category_guid}/retrieve")
|
1068
|
+
|
1069
|
+
body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
|
1070
|
+
|
1071
|
+
response = await self._async_make_request("POST", url, body)
|
1072
|
+
return response.json().get("element", "No Category found")
|
1073
|
+
|
1074
|
+
def get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
|
1075
|
+
server_name: str = None) -> list | str:
|
1076
|
+
""" Retrieve the requested glossary category metadata element. The optional request body contain an effective
|
1077
|
+
time for the query..
|
1078
|
+
|
1079
|
+
Parameters
|
1080
|
+
----------
|
1081
|
+
glossary_category_guid: str
|
1082
|
+
The identity of the glossary category to search.
|
1083
|
+
effective_time, datetime, optional
|
1084
|
+
If specified, the category should only be returned if it was effective at the specified time.
|
1085
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1086
|
+
server_name : str, optional
|
1087
|
+
The name of the server to configure.
|
1088
|
+
If not provided, the server name associated with the instance is used.
|
1089
|
+
|
1090
|
+
Returns
|
1091
|
+
-------
|
1092
|
+
List | str
|
1093
|
+
|
1094
|
+
Details for the category with the glossary category GUID.
|
1095
|
+
|
1096
|
+
Raises
|
1097
|
+
------
|
1098
|
+
|
1099
|
+
InvalidParameterException
|
1100
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1101
|
+
PropertyServerException
|
1102
|
+
Raised by the server when an issue arises in processing a valid request
|
1103
|
+
NotAuthorizedException
|
1104
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1105
|
+
|
1106
|
+
"""
|
1107
|
+
loop = asyncio.get_event_loop()
|
1108
|
+
response = loop.run_until_complete(
|
1109
|
+
self._async_get_categories_by_guid(glossary_category_guid, effective_time, server_name))
|
1110
|
+
return response
|
1111
|
+
|
1112
|
+
async def _async_get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
|
1113
|
+
server_name: str = None) -> list | str:
|
1114
|
+
""" Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
|
1115
|
+
element for the glossary category with the supplied unique identifier. If the requested category
|
1116
|
+
does not have a parent category, null is returned. The optional request body contain an effective time
|
1117
|
+
for the query.
|
1118
|
+
|
1119
|
+
Async version.
|
1120
|
+
|
1121
|
+
Parameters
|
1122
|
+
----------
|
1123
|
+
glossary_category_guid: str
|
1124
|
+
The identity of the glossary category to search.
|
1125
|
+
effective_time, datetime, optional
|
1126
|
+
If specified, the category should only be returned if it was effective at the specified time.
|
1127
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1128
|
+
server_name : str, optional
|
1129
|
+
The name of the server to configure.
|
1130
|
+
If not provided, the server name associated with the instance is used.
|
1131
|
+
|
1132
|
+
Returns
|
1133
|
+
-------
|
1134
|
+
List | str
|
1135
|
+
|
1136
|
+
Details for the parent category with the glossary category GUID.
|
1137
|
+
|
1138
|
+
Raises
|
1139
|
+
------
|
1140
|
+
|
1141
|
+
InvalidParameterException
|
1142
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1143
|
+
PropertyServerException
|
1144
|
+
Raised by the server when an issue arises in processing a valid request
|
1145
|
+
NotAuthorizedException
|
1146
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1147
|
+
|
1148
|
+
"""
|
1149
|
+
if server_name is None:
|
1150
|
+
server_name = self.server_name
|
1151
|
+
|
1152
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
|
1153
|
+
f"{glossary_category_guid}/parent/retrieve")
|
1154
|
+
|
1155
|
+
body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
|
1156
|
+
|
1157
|
+
response = await self._async_make_request("POST", url, body)
|
1158
|
+
return response.json().get("element", "No Parent Category found")
|
1159
|
+
|
1160
|
+
def get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
|
1161
|
+
server_name: str = None) -> list | str:
|
1162
|
+
""" Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
|
1163
|
+
element for the glossary category with the supplied unique identifier. If the requested category
|
1164
|
+
does not have a parent category, null is returned. The optional request body contain an effective time
|
1165
|
+
for the query.
|
1166
|
+
|
1167
|
+
Parameters
|
1168
|
+
----------
|
1169
|
+
glossary_category_guid: str
|
1170
|
+
The identity of the glossary category to search.
|
1171
|
+
effective_time, datetime, optional
|
1172
|
+
If specified, the category should only be returned if it was effective at the specified time.
|
1173
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
|
1174
|
+
server_name : str, optional
|
1175
|
+
The name of the server to configure.
|
1176
|
+
If not provided, the server name associated with the instance is used.
|
1177
|
+
|
1178
|
+
Returns
|
1179
|
+
-------
|
1180
|
+
List | str
|
1181
|
+
|
1182
|
+
Details for the parent category with the glossary category GUID.
|
1183
|
+
|
1184
|
+
Raises
|
1185
|
+
------
|
1186
|
+
|
1187
|
+
InvalidParameterException
|
1188
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1189
|
+
PropertyServerException
|
1190
|
+
Raised by the server when an issue arises in processing a valid request
|
1191
|
+
NotAuthorizedException
|
1192
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1193
|
+
|
1194
|
+
"""
|
1195
|
+
loop = asyncio.get_event_loop()
|
1196
|
+
response = loop.run_until_complete(
|
1197
|
+
self._async_get_category_parent(glossary_category_guid, effective_time, server_name))
|
1198
|
+
return response
|
1199
|
+
|
1200
|
+
#
|
1201
|
+
# Terms
|
1202
|
+
#
|
1203
|
+
async def _async_create_controlled_glossary_term(self, glossary_guid: str, body: dict,
|
1204
|
+
server_name: str = None) -> str:
|
1205
|
+
""" Create a term for a controlled glossary.
|
1206
|
+
See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
|
1207
|
+
The request body also supports the specification of an effective time for the query.
|
1208
|
+
|
1209
|
+
Async Version.
|
1210
|
+
|
1211
|
+
Parameters
|
1212
|
+
----------
|
1213
|
+
glossary_guid : str
|
1214
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1215
|
+
body: dict
|
1216
|
+
The dictionary to create te controlled glossary term for. Example below.
|
1217
|
+
server_name : str, optional
|
1218
|
+
The name of the server to get the configured access services for.
|
1219
|
+
If not provided, the server name associated with the instance is used.
|
1220
|
+
|
1221
|
+
Returns
|
1222
|
+
-------
|
1223
|
+
str:
|
1224
|
+
The unique guid for the created term.
|
1225
|
+
|
1226
|
+
Raises
|
1227
|
+
------
|
1228
|
+
InvalidParameterException
|
1229
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1230
|
+
PropertyServerException
|
1231
|
+
Raised by the server when an issue arises in processing a valid request.
|
1232
|
+
NotAuthorizedException
|
1233
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1234
|
+
Notes
|
1235
|
+
-----
|
1236
|
+
|
1237
|
+
Sample body like:
|
1238
|
+
{
|
1239
|
+
"class" : "ReferenceableRequestBody",
|
1240
|
+
"elementProperties" :
|
1241
|
+
{
|
1242
|
+
"class" : "GlossaryTermProperties",
|
1243
|
+
"qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
|
1244
|
+
"displayName" : "term name",
|
1245
|
+
"summary" : "This is the short description.",
|
1246
|
+
"description" : "This is the long description of the term.",
|
1247
|
+
"abbreviation" : "GT",
|
1248
|
+
"examples" : "Add examples and descriptions here.",
|
1249
|
+
"usage" : "This is how the concept described by the glossary term is used.",
|
1250
|
+
"publishVersionIdentifier" : "V1.0",
|
1251
|
+
"additionalProperties" :
|
1252
|
+
{
|
1253
|
+
"propertyName1" : "xxxx",
|
1254
|
+
"propertyName2" : "xxxx"
|
1255
|
+
}
|
1256
|
+
},
|
1257
|
+
"initialStatus" : "DRAFT"
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
"""
|
1261
|
+
|
1262
|
+
if server_name is None:
|
1263
|
+
server_name = self.server_name
|
1264
|
+
validate_guid(glossary_guid)
|
1265
|
+
|
1266
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
1267
|
+
f"{glossary_guid}/terms/new-controlled"
|
1268
|
+
)
|
1269
|
+
|
1270
|
+
response = await self._async_make_request("POST", url, body)
|
1271
|
+
|
1272
|
+
return response.json().get("guid", "Term not created")
|
1273
|
+
|
1274
|
+
def create_controlled_glossary_term(self, glossary_guid: str, body: dict, server_name: str = None) -> str:
|
1275
|
+
""" Create a term for a controlled glossary.
|
1276
|
+
See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
|
1277
|
+
The request body also supports the specification of an effective time for the query.
|
1278
|
+
|
1279
|
+
Parameters
|
1280
|
+
----------
|
1281
|
+
glossary_guid : str
|
1282
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1283
|
+
body: dict
|
1284
|
+
The dictionary to create te controlled glossary term for. Example below.
|
1285
|
+
server_name : str, optional
|
1286
|
+
The name of the server to get the configured access services for.
|
1287
|
+
If not provided, the server name associated with the instance is used.
|
1288
|
+
|
1289
|
+
Returns
|
1290
|
+
-------
|
1291
|
+
str:
|
1292
|
+
The unique guid for the created term.
|
1293
|
+
|
1294
|
+
Raises
|
1295
|
+
------
|
1296
|
+
InvalidParameterException
|
1297
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1298
|
+
PropertyServerException
|
1299
|
+
Raised by the server when an issue arises in processing a valid request.
|
1300
|
+
NotAuthorizedException
|
1301
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1302
|
+
Notes
|
1303
|
+
-----
|
1304
|
+
|
1305
|
+
Sample body like:
|
1306
|
+
{
|
1307
|
+
"class" : "ReferenceableRequestBody",
|
1308
|
+
"elementProperties" :
|
1309
|
+
{
|
1310
|
+
"class" : "GlossaryTermProperties",
|
1311
|
+
"qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
|
1312
|
+
"displayName" : "term name",
|
1313
|
+
"summary" : "This is the short description.",
|
1314
|
+
"description" : "This is the long description of the term.",
|
1315
|
+
"abbreviation" : "GT",
|
1316
|
+
"examples" : "Add examples and descriptions here.",
|
1317
|
+
"usage" : "This is how the concept described by the glossary term is used.",
|
1318
|
+
"publishVersionIdentifier" : "V1.0",
|
1319
|
+
"additionalProperties" :
|
1320
|
+
{
|
1321
|
+
"propertyName1" : "xxxx",
|
1322
|
+
"propertyName2" : "xxxx"
|
1323
|
+
}
|
1324
|
+
},
|
1325
|
+
"initialStatus" : "DRAFT"
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
"""
|
1329
|
+
loop = asyncio.get_event_loop()
|
1330
|
+
response = loop.run_until_complete(
|
1331
|
+
self._async_create_controlled_glossary_term(glossary_guid, body, server_name))
|
1332
|
+
|
1333
|
+
return response
|
1334
|
+
|
1335
|
+
async def _async_create_term_copy(self, glossary_guid: str, glossary_term_guid: str, new_display_name: str,
|
1336
|
+
version_id: str, term_status: str = "PROPOSED", server_name: str = None) -> str:
|
1337
|
+
""" Create a new term from an existing term.
|
1338
|
+
|
1339
|
+
Async Version.
|
1340
|
+
|
1341
|
+
Parameters
|
1342
|
+
----------
|
1343
|
+
glossary_guid : str
|
1344
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1345
|
+
glossary_term_guid: str
|
1346
|
+
Unique identifier for the source glossary term.
|
1347
|
+
new_display_named: str
|
1348
|
+
The display name of the new term.
|
1349
|
+
version_id: str
|
1350
|
+
The version identifier of the new term.
|
1351
|
+
term_status: str, optional, default = "PROPOSED"
|
1352
|
+
The status of the term
|
1353
|
+
server_name : str, optional
|
1354
|
+
The name of the server to get the configured access services for.
|
1355
|
+
If not provided, the server name associated with the instance is used.
|
1356
|
+
|
1357
|
+
Returns
|
1358
|
+
-------
|
1359
|
+
str:
|
1360
|
+
The unique guid for the created term.
|
1361
|
+
|
1362
|
+
Raises
|
1363
|
+
------
|
1364
|
+
InvalidParameterException
|
1365
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1366
|
+
PropertyServerException
|
1367
|
+
Raised by the server when an issue arises in processing a valid request.
|
1368
|
+
NotAuthorizedException
|
1369
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1370
|
+
Notes
|
1371
|
+
-----
|
1372
|
+
|
1373
|
+
"""
|
1374
|
+
|
1375
|
+
if server_name is None:
|
1376
|
+
server_name = self.server_name
|
1377
|
+
validate_guid(glossary_guid)
|
1378
|
+
validate_guid(glossary_term_guid)
|
1379
|
+
|
1380
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
1381
|
+
f"{glossary_guid}/terms/from-template/{glossary_term_guid}"
|
1382
|
+
)
|
1383
|
+
|
1384
|
+
body = {
|
1385
|
+
"class": "GlossaryTemplateRequestBody",
|
1386
|
+
"elementProperties":
|
1387
|
+
{
|
1388
|
+
"class": "TemplateProperties",
|
1389
|
+
"qualifiedName": f"Term-{new_display_name}-{time.asctime()}",
|
1390
|
+
"displayName": new_display_name,
|
1391
|
+
"versionIdentifier": version_id
|
1392
|
+
},
|
1393
|
+
"glossaryTermStatus": term_status
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
response = await self._async_make_request("POST", url, body)
|
1397
|
+
|
1398
|
+
return response.json().get("guid", "Term not created")
|
1399
|
+
|
1400
|
+
def create_term_copy(self, glossary_guid: str, glossary_term_guid: str, new_display_name: str,
|
1401
|
+
version_id: str, term_status: str = "PROPOSED", server_name: str = None) -> str:
|
1402
|
+
""" Create a new term from an existing term.
|
1403
|
+
|
1404
|
+
Parameters
|
1405
|
+
----------
|
1406
|
+
glossary_guid : str
|
1407
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1408
|
+
glossary_term_guid: str
|
1409
|
+
Unique identifier for the source glossary term.
|
1410
|
+
new_display_named: str
|
1411
|
+
The display name of the new term.
|
1412
|
+
version_id: str
|
1413
|
+
The version identifier of the new term.
|
1414
|
+
term_status: str, optional, default = "PROPOSED"
|
1415
|
+
The status of the term
|
1416
|
+
server_name : str, optional
|
1417
|
+
The name of the server to get the configured access services for.
|
1418
|
+
If not provided, the server name associated with the instance is used.
|
1419
|
+
|
1420
|
+
Returns
|
1421
|
+
-------
|
1422
|
+
str:
|
1423
|
+
The unique guid for the created term.
|
1424
|
+
|
1425
|
+
Raises
|
1426
|
+
------
|
1427
|
+
InvalidParameterException
|
1428
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1429
|
+
PropertyServerException
|
1430
|
+
Raised by the server when an issue arises in processing a valid request.
|
1431
|
+
NotAuthorizedException
|
1432
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1433
|
+
Notes
|
1434
|
+
-----
|
1435
|
+
|
1436
|
+
"""
|
1437
|
+
loop = asyncio.get_event_loop()
|
1438
|
+
response = loop.run_until_complete(
|
1439
|
+
self._async_create_term_copy(glossary_guid, glossary_term_guid, new_display_name,
|
1440
|
+
version_id, term_status, server_name))
|
1441
|
+
|
1442
|
+
return response
|
1443
|
+
|
1444
|
+
async def _async_add_data_field_to_term(self, glossary_term_guid: str, body: dict,
|
1445
|
+
server_name: str = None) -> None:
|
1446
|
+
""" Add the data field values classification to a glossary term
|
1447
|
+
|
1448
|
+
Async Version.
|
1449
|
+
|
1450
|
+
Parameters
|
1451
|
+
----------
|
1452
|
+
glossary_guid : str
|
1453
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1454
|
+
glossary_term_guid: str
|
1455
|
+
Unique identifier for the source glossary term.
|
1456
|
+
body: dict
|
1457
|
+
Body containing information about the data field to add
|
1458
|
+
server_name : str, optional
|
1459
|
+
The name of the server to get the configured access services for.
|
1460
|
+
If not provided, the server name associated with the instance is used.
|
1461
|
+
|
1462
|
+
Returns
|
1463
|
+
-------
|
1464
|
+
None
|
1465
|
+
|
1466
|
+
Raises
|
1467
|
+
------
|
1468
|
+
InvalidParameterException
|
1469
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1470
|
+
PropertyServerException
|
1471
|
+
Raised by the server when an issue arises in processing a valid request.
|
1472
|
+
NotAuthorizedException
|
1473
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1474
|
+
Notes
|
1475
|
+
-----
|
1476
|
+
Body is of the structure:
|
1477
|
+
|
1478
|
+
{
|
1479
|
+
"class" : "ClassificationRequestBody",
|
1480
|
+
"properties" :
|
1481
|
+
{
|
1482
|
+
"class" : "DataFieldValuesProperties",
|
1483
|
+
"defaultValue" : "Add default value here",
|
1484
|
+
"sampleValues" : [ "Sample Value 1", "Sample Value 2"],
|
1485
|
+
"dataPattern" : ["add data pattern here"],
|
1486
|
+
"namePattern" : ["add column pattern here"]
|
1487
|
+
}
|
1488
|
+
}
|
1489
|
+
"""
|
1490
|
+
|
1491
|
+
if server_name is None:
|
1492
|
+
server_name = self.server_name
|
1493
|
+
validate_guid(glossary_term_guid)
|
1494
|
+
|
1495
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
1496
|
+
f"terms/{glossary_term_guid}/is-data-field"
|
1497
|
+
)
|
1498
|
+
|
1499
|
+
await self._async_make_request("POST", url, body)
|
1500
|
+
return
|
1501
|
+
|
1502
|
+
def add_data_field_to_term(self, glossary_term_guid: str, body: dict, server_name: str = None) -> None:
|
1503
|
+
""" Add the data field values classification to a glossary term
|
1504
|
+
|
1505
|
+
Parameters
|
1506
|
+
----------
|
1507
|
+
glossary_term_guid: str
|
1508
|
+
Unique identifier for the source glossary term.
|
1509
|
+
body: dict
|
1510
|
+
Body containing information about the data field to add
|
1511
|
+
server_name : str, optional
|
1512
|
+
The name of the server to get the configured access services for.
|
1513
|
+
If not provided, the server name associated with the instance is used.
|
1514
|
+
|
1515
|
+
Returns
|
1516
|
+
-------
|
1517
|
+
None
|
1518
|
+
|
1519
|
+
Raises
|
1520
|
+
------
|
1521
|
+
InvalidParameterException
|
1522
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1523
|
+
PropertyServerException
|
1524
|
+
Raised by the server when an issue arises in processing a valid request.
|
1525
|
+
NotAuthorizedException
|
1526
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1527
|
+
Notes
|
1528
|
+
-----
|
1529
|
+
Body is of the structure:
|
1530
|
+
|
1531
|
+
{
|
1532
|
+
"class" : "ClassificationRequestBody",
|
1533
|
+
"properties" :
|
1534
|
+
{
|
1535
|
+
"class" : "DataFieldValuesProperties",
|
1536
|
+
"defaultValue" : "Add default value here",
|
1537
|
+
"sampleValues" : [ "Sample Value 1", "Sample Value 2"],
|
1538
|
+
"dataPattern" : ["add data pattern here"],
|
1539
|
+
"namePattern" : ["add column pattern here"]
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
"""
|
1543
|
+
loop = asyncio.get_event_loop()
|
1544
|
+
loop.run_until_complete(
|
1545
|
+
self._async_add_data_field_to_term(glossary_term_guid, body, server_name))
|
1546
|
+
|
1547
|
+
return
|
1548
|
+
|
1549
|
+
async def _async_add_confidentiality_to_term(self, glossary_term_guid: str,
|
1550
|
+
confidentiality_level: int, server_name: str = None) -> None:
|
1551
|
+
""" Add the confidentiality classification to a glossary term
|
1552
|
+
|
1553
|
+
Async Version.
|
1554
|
+
|
1555
|
+
Parameters
|
1556
|
+
----------
|
1557
|
+
glossary_term_guid: str
|
1558
|
+
Unique identifier for the source glossary term.
|
1559
|
+
confidentiality_level: int
|
1560
|
+
The level of confidentiality to classify the term with.
|
1561
|
+
server_name : str, optional
|
1562
|
+
The name of the server to get the configured access services for.
|
1563
|
+
If not provided, the server name associated with the instance is used.
|
1564
|
+
|
1565
|
+
Returns
|
1566
|
+
-------
|
1567
|
+
None
|
1568
|
+
|
1569
|
+
Raises
|
1570
|
+
------
|
1571
|
+
InvalidParameterException
|
1572
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1573
|
+
PropertyServerException
|
1574
|
+
Raised by the server when an issue arises in processing a valid request.
|
1575
|
+
NotAuthorizedException
|
1576
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1577
|
+
Notes
|
1578
|
+
-----
|
1579
|
+
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
1580
|
+
for a list of default confidentiality levels.
|
1581
|
+
|
1582
|
+
"""
|
1583
|
+
|
1584
|
+
if server_name is None:
|
1585
|
+
server_name = self.server_name
|
1586
|
+
validate_guid(glossary_term_guid)
|
1587
|
+
|
1588
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
|
1589
|
+
f"{glossary_term_guid}/confidentiality"
|
1590
|
+
)
|
1591
|
+
|
1592
|
+
body = {
|
1593
|
+
"class": "ClassificationRequestBody",
|
1594
|
+
"properties":
|
1595
|
+
{
|
1596
|
+
"class": "GovernanceClassificationProperties",
|
1597
|
+
"levelIdentifier": confidentiality_level
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
await self._async_make_request("POST", url, body)
|
1602
|
+
return
|
1603
|
+
|
1604
|
+
def add_confidentiality_to_term(self, glossary_term_guid: str,
|
1605
|
+
confidentiality_level: int, server_name: str = None) -> str:
|
1606
|
+
""" Add the confidentiality classification to a glossary term
|
1607
|
+
|
1608
|
+
Parameters
|
1609
|
+
----------
|
1610
|
+
glossary_term_guid: str
|
1611
|
+
Unique identifier for the source glossary term.
|
1612
|
+
confidentiality_level: int
|
1613
|
+
The level of confidentiality to classify the term with.
|
1614
|
+
server_name : str, optional
|
1615
|
+
The name of the server to get the configured access services for.
|
1616
|
+
If not provided, the server name associated with the instance is used.
|
1617
|
+
|
1618
|
+
Returns
|
1619
|
+
-------
|
1620
|
+
None
|
1621
|
+
|
1622
|
+
Raises
|
1623
|
+
------
|
1624
|
+
InvalidParameterException
|
1625
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1626
|
+
PropertyServerException
|
1627
|
+
Raised by the server when an issue arises in processing a valid request.
|
1628
|
+
NotAuthorizedException
|
1629
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1630
|
+
Notes
|
1631
|
+
-----
|
1632
|
+
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
1633
|
+
for a list of default confidentiality levels.
|
1634
|
+
|
1635
|
+
"""
|
1636
|
+
loop = asyncio.get_event_loop()
|
1637
|
+
response = loop.run_until_complete(
|
1638
|
+
self._async_add_confidentiality_to_term(glossary_term_guid, confidentiality_level,
|
1639
|
+
server_name))
|
1640
|
+
|
1641
|
+
return
|
1642
|
+
|
1643
|
+
async def _async_add_subject_area_to_term(self, glossary_term_guid: str, subject_area: str,
|
1644
|
+
server_name: str = None) -> None:
|
1645
|
+
""" Add the confidentiality classification to a glossary term
|
1646
|
+
|
1647
|
+
Async Version.
|
1648
|
+
|
1649
|
+
Parameters
|
1650
|
+
----------
|
1651
|
+
glossary_term_guid: str
|
1652
|
+
Unique identifier for the source glossary term.
|
1653
|
+
subject_area: str
|
1654
|
+
The subject area to classify the term with.
|
1655
|
+
server_name : str, optional
|
1656
|
+
The name of the server to get the configured access services for.
|
1657
|
+
If not provided, the server name associated with the instance is used.
|
1658
|
+
|
1659
|
+
Returns
|
1660
|
+
-------
|
1661
|
+
None
|
1662
|
+
|
1663
|
+
Raises
|
1664
|
+
------
|
1665
|
+
InvalidParameterException
|
1666
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1667
|
+
PropertyServerException
|
1668
|
+
Raised by the server when an issue arises in processing a valid request.
|
1669
|
+
NotAuthorizedException
|
1670
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1671
|
+
Notes
|
1672
|
+
-----
|
1673
|
+
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
1674
|
+
for a list of default confidentiality levels.
|
1675
|
+
|
1676
|
+
"""
|
1677
|
+
|
1678
|
+
if server_name is None:
|
1679
|
+
server_name = self.server_name
|
1680
|
+
validate_guid(glossary_term_guid)
|
1681
|
+
|
1682
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
|
1683
|
+
f"{glossary_term_guid}/subject-area-member"
|
1684
|
+
)
|
1685
|
+
|
1686
|
+
body = {
|
1687
|
+
"class": "ClassificationRequestBody",
|
1688
|
+
"properties":
|
1689
|
+
{
|
1690
|
+
"class": "SubjectAreaMemberProperties",
|
1691
|
+
"subjectAreaName": subject_area
|
1692
|
+
}
|
1693
|
+
}
|
1694
|
+
|
1695
|
+
await self._async_make_request("POST", url, body)
|
1696
|
+
return
|
1697
|
+
|
1698
|
+
def add_subject_area_to_term(self, glossary_term_guid: str, subject_area: str, server_name: str = None) -> None:
|
1699
|
+
""" Add the confidentiality classification to a glossary term
|
1700
|
+
|
1701
|
+
Parameters
|
1702
|
+
----------
|
1703
|
+
glossary_term_guid: str
|
1704
|
+
Unique identifier for the source glossary term.
|
1705
|
+
subject_area: str
|
1706
|
+
The subject area to classify the term with.
|
1707
|
+
server_name : str, optional
|
1708
|
+
The name of the server to get the configured access services for.
|
1709
|
+
If not provided, the server name associated with the instance is used.
|
1710
|
+
|
1711
|
+
Returns
|
1712
|
+
-------
|
1713
|
+
None
|
1714
|
+
|
1715
|
+
Raises
|
1716
|
+
------
|
1717
|
+
InvalidParameterException
|
1718
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1719
|
+
PropertyServerException
|
1720
|
+
Raised by the server when an issue arises in processing a valid request.
|
1721
|
+
NotAuthorizedException
|
1722
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1723
|
+
Notes
|
1724
|
+
-----
|
1725
|
+
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
1726
|
+
for a list of default confidentiality levels.
|
1727
|
+
|
1728
|
+
"""
|
1729
|
+
loop = asyncio.get_event_loop()
|
1730
|
+
response = loop.run_until_complete(
|
1731
|
+
self._async_add_subject_area_to_term(glossary_term_guid, subject_area,
|
1732
|
+
server_name))
|
1733
|
+
|
1734
|
+
return
|
1735
|
+
|
1736
|
+
async def _async_update_term(self, glossary_term_guid: str, body: dict, is_merge_update: bool,
|
1737
|
+
server_name: str = None) -> None:
|
1738
|
+
""" Add the data field values classification to a glossary term
|
1739
|
+
|
1740
|
+
Async Version.
|
1741
|
+
|
1742
|
+
Parameters
|
1743
|
+
----------
|
1744
|
+
glossary_term_guid: str
|
1745
|
+
Unique identifier for the source glossary term.
|
1746
|
+
body: dict
|
1747
|
+
Body containing information about the data field to add
|
1748
|
+
is_merge_update: bool
|
1749
|
+
Whether the data field values should be merged with existing definition or replace it.
|
1750
|
+
server_name : str, optional
|
1751
|
+
The name of the server to get the configured access services for.
|
1752
|
+
If not provided, the server name associated with the instance is used.
|
1753
|
+
|
1754
|
+
Returns
|
1755
|
+
-------
|
1756
|
+
None
|
1757
|
+
|
1758
|
+
Raises
|
1759
|
+
------
|
1760
|
+
InvalidParameterException
|
1761
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1762
|
+
PropertyServerException
|
1763
|
+
Raised by the server when an issue arises in processing a valid request.
|
1764
|
+
NotAuthorizedException
|
1765
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1766
|
+
Notes
|
1767
|
+
-----
|
1768
|
+
An example body is:
|
1769
|
+
|
1770
|
+
{
|
1771
|
+
"class" : "ReferenceableRequestBody",
|
1772
|
+
"elementProperties" :
|
1773
|
+
{
|
1774
|
+
"class" : "GlossaryTermProperties",
|
1775
|
+
"description" : "This is the long description of the term. And this is some more text."
|
1776
|
+
},
|
1777
|
+
"updateDescription" : "Final updates based on in-house review comments."
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
"""
|
1781
|
+
|
1782
|
+
if server_name is None:
|
1783
|
+
server_name = self.server_name
|
1784
|
+
validate_guid(glossary_term_guid)
|
1785
|
+
is_merge_update_s = str(is_merge_update).lower()
|
1786
|
+
|
1787
|
+
url = (
|
1788
|
+
f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/terms/{glossary_term_guid}/"
|
1789
|
+
f"update?isMergeUpdate={is_merge_update_s}"
|
1790
|
+
)
|
1791
|
+
|
1792
|
+
await self._async_make_request("POST", url, body)
|
1793
|
+
return
|
1794
|
+
|
1795
|
+
def update_term(self, glossary_term_guid: str, body: dict, is_merge_update: bool,
|
1796
|
+
server_name: str = None) -> None:
|
1797
|
+
""" Add the data field values classification to a glossary term
|
1798
|
+
|
1799
|
+
Async Version.
|
1800
|
+
|
1801
|
+
Parameters
|
1802
|
+
----------
|
1803
|
+
glossary_term_guid: str
|
1804
|
+
Unique identifier for the source glossary term.
|
1805
|
+
body: dict
|
1806
|
+
Body containing information about the data field to add
|
1807
|
+
is_merge_update: bool
|
1808
|
+
Whether the data field values should be merged with existing definition or replace it.
|
1809
|
+
server_name : str, optional
|
1810
|
+
The name of the server to get the configured access services for.
|
1811
|
+
If not provided, the server name associated with the instance is used.
|
1812
|
+
|
1813
|
+
Returns
|
1814
|
+
-------
|
1815
|
+
None
|
1816
|
+
|
1817
|
+
Raises
|
1818
|
+
------
|
1819
|
+
InvalidParameterException
|
1820
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1821
|
+
PropertyServerException
|
1822
|
+
Raised by the server when an issue arises in processing a valid request.
|
1823
|
+
NotAuthorizedException
|
1824
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1825
|
+
Notes
|
1826
|
+
-----
|
1827
|
+
An example body is:
|
1828
|
+
|
1829
|
+
{
|
1830
|
+
"class" : "ReferenceableRequestBody",
|
1831
|
+
"elementProperties" :
|
1832
|
+
{
|
1833
|
+
"class" : "GlossaryTermProperties",
|
1834
|
+
"description" : "This is the long description of the term. And this is some more text."
|
1835
|
+
},
|
1836
|
+
"updateDescription" : "Final updates based on in-house review comments."
|
1837
|
+
}
|
1838
|
+
|
1839
|
+
"""
|
1840
|
+
loop = asyncio.get_event_loop()
|
1841
|
+
loop.run_until_complete(
|
1842
|
+
self._async_update_term(glossary_term_guid, body, is_merge_update, server_name))
|
1843
|
+
|
1844
|
+
return
|
1845
|
+
|
1846
|
+
async def _async_update_term_version_id(self, glossary_term_guid: str, new_version_identifier: str,
|
1847
|
+
server_name: str = None) -> None:
|
1848
|
+
""" Update a glossary term's version identifier
|
1849
|
+
|
1850
|
+
Async Version.
|
1851
|
+
|
1852
|
+
Parameters
|
1853
|
+
----------
|
1854
|
+
glossary_term_guid: str
|
1855
|
+
Unique identifier for the source glossary term.
|
1856
|
+
new_version_identifier: str
|
1857
|
+
The new version identifier to update the term with.
|
1858
|
+
server_name : str, optional
|
1859
|
+
The name of the server to get the configured access services for.
|
1860
|
+
If not provided, the server name associated with the instance is used.
|
1861
|
+
|
1862
|
+
Returns
|
1863
|
+
-------
|
1864
|
+
None
|
1865
|
+
|
1866
|
+
Raises
|
1867
|
+
------
|
1868
|
+
InvalidParameterException
|
1869
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1870
|
+
PropertyServerException
|
1871
|
+
Raised by the server when an issue arises in processing a valid request.
|
1872
|
+
NotAuthorizedException
|
1873
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1874
|
+
Notes
|
1875
|
+
-----
|
1876
|
+
This is a useful example of a term update, specifying a new version identifier.
|
1877
|
+
|
1878
|
+
"""
|
1879
|
+
|
1880
|
+
if server_name is None:
|
1881
|
+
server_name = self.server_name
|
1882
|
+
validate_guid(glossary_term_guid)
|
1883
|
+
|
1884
|
+
url = (
|
1885
|
+
f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/terms/{glossary_term_guid}/"
|
1886
|
+
f"update?isMergeUpdate=true"
|
1887
|
+
)
|
1888
|
+
|
1889
|
+
body = {
|
1890
|
+
"class": "ReferenceableRequestBody",
|
1891
|
+
"elementProperties":
|
1892
|
+
{
|
1893
|
+
"class": "GlossaryTermProperties",
|
1894
|
+
"publishVersionIdentifier": new_version_identifier
|
1895
|
+
}
|
1896
|
+
}
|
1897
|
+
await self._async_make_request("POST", url, body)
|
1898
|
+
return
|
1899
|
+
|
1900
|
+
def update_term_version_id(self, glossary_term_guid: str, new_version_identifier: str,
|
1901
|
+
server_name: str = None) -> None:
|
1902
|
+
""" Update a glossary term's version identifier
|
1903
|
+
|
1904
|
+
Async Version.
|
1905
|
+
|
1906
|
+
Parameters
|
1907
|
+
----------
|
1908
|
+
glossary_term_guid: str
|
1909
|
+
Unique identifier for the source glossary term.
|
1910
|
+
new_version_identifier: str
|
1911
|
+
The new version identifier to update the term with.
|
1912
|
+
server_name : str, optional
|
1913
|
+
The name of the server to get the configured access services for.
|
1914
|
+
If not provided, the server name associated with the instance is used.
|
1915
|
+
|
1916
|
+
Returns
|
1917
|
+
-------
|
1918
|
+
None
|
1919
|
+
|
1920
|
+
Raises
|
1921
|
+
------
|
1922
|
+
InvalidParameterException
|
1923
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1924
|
+
PropertyServerException
|
1925
|
+
Raised by the server when an issue arises in processing a valid request.
|
1926
|
+
NotAuthorizedException
|
1927
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1928
|
+
Notes
|
1929
|
+
-----
|
1930
|
+
This is a useful example of a term update, specifying a new version identifier.
|
1931
|
+
|
1932
|
+
"""
|
1933
|
+
loop = asyncio.get_event_loop()
|
1934
|
+
loop.run_until_complete(
|
1935
|
+
self._async_update_term_version_id(glossary_term_guid, new_version_identifier, server_name))
|
1936
|
+
|
1937
|
+
return
|
1938
|
+
|
1939
|
+
async def _async_get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
|
1940
|
+
effective_time: str = None, start_from: int = 0,
|
1941
|
+
page_size: int = None) -> list | str:
|
1942
|
+
""" Retrieve ALL the glossary terms in a category.
|
1943
|
+
The request body also supports the specification of an effective time for the query.
|
1944
|
+
|
1945
|
+
Async Version.
|
1946
|
+
|
1947
|
+
Parameters
|
1948
|
+
----------
|
1949
|
+
glossary_category_guid : str
|
1950
|
+
Unique identifier for the glossary category to retrieve terms from.
|
1951
|
+
server_name : str, optional
|
1952
|
+
The name of the server to get the configured access services for.
|
1953
|
+
If not provided, the server name associated with the instance is used.
|
1954
|
+
effective_time : str, optional
|
1955
|
+
If specified, the terms are returned if they are active at the `effective_time
|
1956
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1957
|
+
start_from: int, optional defaults to 0
|
1958
|
+
The page number to start retrieving elements from
|
1959
|
+
page_size : int, optional defaults to None
|
1960
|
+
The number of elements to retrieve
|
1961
|
+
Returns
|
1962
|
+
-------
|
1963
|
+
dict
|
1964
|
+
The glossary definition associated with the glossary_guid
|
1965
|
+
|
1966
|
+
Raises
|
1967
|
+
------
|
1968
|
+
InvalidParameterException
|
1969
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1970
|
+
PropertyServerException
|
1971
|
+
Raised by the server when an issue arises in processing a valid request.
|
1972
|
+
NotAuthorizedException
|
1973
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
1974
|
+
Notes
|
1975
|
+
-----
|
1976
|
+
"""
|
1977
|
+
|
1978
|
+
if server_name is None:
|
1979
|
+
server_name = self.server_name
|
1980
|
+
validate_guid(glossary_category_guid)
|
1981
|
+
|
1982
|
+
if page_size is None:
|
1983
|
+
page_size = self.page_size
|
1984
|
+
|
1985
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
|
1986
|
+
f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
|
1987
|
+
|
1988
|
+
if effective_time is not None:
|
1989
|
+
body = {"effectiveTime": effective_time}
|
1990
|
+
response = await self._async_make_request("POST", url, body)
|
1991
|
+
else:
|
1992
|
+
response = await self._async_make_request("POST", url)
|
1993
|
+
|
1994
|
+
return response.json().get("elementList", "No terms found")
|
1995
|
+
|
1996
|
+
def get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
|
1997
|
+
effective_time: str = None, start_from: int = 0,
|
1998
|
+
page_size: int = None) -> list | str:
|
1999
|
+
""" Retrieve ALL the glossary terms in a category.
|
2000
|
+
The request body also supports the specification of an effective time for the query.
|
2001
|
+
|
2002
|
+
Async Version.
|
2003
|
+
|
2004
|
+
Parameters
|
2005
|
+
----------
|
2006
|
+
glossary_category_guid : str
|
2007
|
+
Unique identifier for the glossary category to retrieve terms from.
|
2008
|
+
server_name : str, optional
|
2009
|
+
The name of the server to get the configured access services for.
|
2010
|
+
If not provided, the server name associated with the instance is used.
|
2011
|
+
effective_time : str, optional
|
2012
|
+
If specified, the terms are returned if they are active at the `effective_time.
|
2013
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`.
|
2014
|
+
start_from: int, optional defaults to 0
|
2015
|
+
The page number to start retrieving elements from
|
2016
|
+
page_size : int, optional defaults to None
|
2017
|
+
The number of elements to retrieve
|
2018
|
+
Returns
|
2019
|
+
-------
|
2020
|
+
dict
|
2021
|
+
The glossary definition associated with the glossary_guid
|
2022
|
+
|
2023
|
+
Raises
|
2024
|
+
------
|
2025
|
+
InvalidParameterException
|
2026
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2027
|
+
PropertyServerException
|
2028
|
+
Raised by the server when an issue arises in processing a valid request.
|
2029
|
+
NotAuthorizedException
|
2030
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2031
|
+
Notes
|
2032
|
+
-----
|
2033
|
+
"""
|
2034
|
+
loop = asyncio.get_event_loop()
|
2035
|
+
response = loop.run_until_complete(
|
2036
|
+
self._async_get_terms_for_category(glossary_category_guid, server_name, effective_time, start_from,
|
2037
|
+
page_size))
|
2038
|
+
|
2039
|
+
return response
|
2040
|
+
|
2041
|
+
async def _async_get_terms_for_glossary(self, glossary_guid: str, server_name: str = None,
|
2042
|
+
effective_time: str = None, start_from: int = 0,
|
2043
|
+
page_size: int = None) -> list | str:
|
2044
|
+
""" Retrieve the list of glossary terms associated with a glossary.
|
2045
|
+
The request body also supports the specification of an effective time for the query.
|
2046
|
+
Parameters
|
2047
|
+
----------
|
2048
|
+
glossary_guid : str
|
2049
|
+
Unique identifier for the glossary
|
2050
|
+
server_name : str, optional
|
2051
|
+
The name of the server to get the configured access services for.
|
2052
|
+
If not provided, the server name associated with the instance is used.
|
2053
|
+
effective_time : str, optional
|
2054
|
+
If specified, terms are potentially included if they are active at the`effective_time.
|
2055
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`
|
2056
|
+
start_from: int, optional defaults to 0
|
2057
|
+
The page number to start retrieving elements from
|
2058
|
+
page_size : int, optional defaults to None
|
2059
|
+
The number of elements to retrieve
|
2060
|
+
Returns
|
2061
|
+
-------
|
2062
|
+
dict
|
2063
|
+
The glossary definition associated with the glossary_guid
|
2064
|
+
|
2065
|
+
Raises
|
2066
|
+
------
|
2067
|
+
InvalidParameterException
|
2068
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2069
|
+
PropertyServerException
|
2070
|
+
Raised by the server when an issue arises in processing a valid request.
|
2071
|
+
NotAuthorizedException
|
2072
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2073
|
+
Notes
|
2074
|
+
-----
|
2075
|
+
"""
|
2076
|
+
|
2077
|
+
if server_name is None:
|
2078
|
+
server_name = self.server_name
|
2079
|
+
validate_guid(glossary_guid)
|
2080
|
+
|
2081
|
+
if page_size is None:
|
2082
|
+
page_size = self.page_size
|
2083
|
+
|
2084
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
2085
|
+
f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
|
2086
|
+
|
2087
|
+
if effective_time is not None:
|
2088
|
+
body = {"effectiveTime": effective_time}
|
2089
|
+
response = await self._async_make_request("POST", url, body)
|
2090
|
+
else:
|
2091
|
+
response = await self._async_make_request("POST", url)
|
2092
|
+
|
2093
|
+
return response.json().get("elementList", "No terms found")
|
2094
|
+
|
2095
|
+
def get_terms_for_glossary(self, glossary_guid: str, server_name: str = None, effective_time: str = None,
|
2096
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
2097
|
+
""" Retrieve the list of glossary terms associated with a glossary.
|
2098
|
+
The request body also supports the specification of an effective time for the query.
|
2099
|
+
Parameters
|
2100
|
+
----------
|
2101
|
+
glossary_guid : str
|
2102
|
+
Unique identifier for the glossary
|
2103
|
+
server_name : str, optional
|
2104
|
+
The name of the server to get the configured access services for.
|
2105
|
+
If not provided, the server name associated with the instance is used.
|
2106
|
+
effective_time : str, optional
|
2107
|
+
If specified, terms are potentially returned if they are active at the `effective_time`
|
2108
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2109
|
+
start_from: int, optional defaults to 0
|
2110
|
+
The page number to start retrieving elements from
|
2111
|
+
page_size : int, optional defaults to None
|
2112
|
+
The number of elements to retrieve
|
2113
|
+
Returns
|
2114
|
+
-------
|
2115
|
+
dict
|
2116
|
+
The glossary definition associated with the glossary_guid
|
2117
|
+
|
2118
|
+
Raises
|
2119
|
+
------
|
2120
|
+
InvalidParameterException
|
2121
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2122
|
+
PropertyServerException
|
2123
|
+
Raised by the server when an issue arises in processing a valid request.
|
2124
|
+
NotAuthorizedException
|
2125
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2126
|
+
Notes
|
2127
|
+
-----
|
2128
|
+
"""
|
2129
|
+
loop = asyncio.get_event_loop()
|
2130
|
+
response = loop.run_until_complete(
|
2131
|
+
self._async_get_terms_for_glossary(glossary_guid, server_name, effective_time, start_from, page_size))
|
2132
|
+
|
2133
|
+
return response
|
2134
|
+
|
2135
|
+
async def _async_get_term_relationships(self, term_guid: str, server_name: str = None,
|
2136
|
+
effective_time: str = None, start_from: int = 0,
|
2137
|
+
page_size: int = None) -> list | str:
|
2138
|
+
|
2139
|
+
""" This call retrieves details of the glossary terms linked to this glossary term.
|
2140
|
+
Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
|
2141
|
+
Parameters
|
2142
|
+
----------
|
2143
|
+
term_guid : str
|
2144
|
+
Unique identifier for the glossary term
|
2145
|
+
server_name : str, optional
|
2146
|
+
The name of the server to get the configured access services for.
|
2147
|
+
If not provided, the server name associated with the instance is used.
|
2148
|
+
effective_time : str, optional
|
2149
|
+
If specified, term relationships are included if they are active at the `effective_time`.
|
2150
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2151
|
+
start_from: int, optional defaults to 0
|
2152
|
+
The page number to start retrieving elements from
|
2153
|
+
page_size : int, optional defaults to None
|
2154
|
+
The number of elements to retrieve
|
2155
|
+
Returns
|
2156
|
+
-------
|
2157
|
+
dict
|
2158
|
+
The glossary definition associated with the glossary_guid
|
2159
|
+
|
2160
|
+
Raises
|
2161
|
+
------
|
2162
|
+
InvalidParameterException
|
2163
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2164
|
+
PropertyServerException
|
2165
|
+
Raised by the server when an issue arises in processing a valid request.
|
2166
|
+
NotAuthorizedException
|
2167
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2168
|
+
Notes
|
2169
|
+
-----
|
2170
|
+
"""
|
2171
|
+
|
2172
|
+
if server_name is None:
|
2173
|
+
server_name = self.server_name
|
2174
|
+
validate_guid(term_guid)
|
2175
|
+
|
2176
|
+
if page_size is None:
|
2177
|
+
page_size = self.page_size
|
2178
|
+
|
2179
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
|
2180
|
+
f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}")
|
2181
|
+
|
2182
|
+
if effective_time is not None:
|
2183
|
+
body = {"effectiveTime": effective_time}
|
2184
|
+
response = await self._async_make_request("POST", url, body)
|
2185
|
+
else:
|
2186
|
+
response = await self._async_make_request("POST", url)
|
2187
|
+
|
2188
|
+
return response.json().get("elementList", "No terms found")
|
2189
|
+
|
2190
|
+
def get_term_relationships(self, term_guid: str, server_name: str = None, effective_time: str = None,
|
2191
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
2192
|
+
|
2193
|
+
""" This call retrieves details of the glossary terms linked to this glossary term.
|
2194
|
+
Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
|
2195
|
+
Parameters
|
2196
|
+
----------
|
2197
|
+
term_guid : str
|
2198
|
+
Unique identifier for the glossary term
|
2199
|
+
server_name : str, optional
|
2200
|
+
The name of the server to get the configured access services for.
|
2201
|
+
If not provided, the server name associated with the instance is used.
|
2202
|
+
effective_time : str, optional
|
2203
|
+
If specified, term relationships are included if they are active at the `effective_time`.
|
2204
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2205
|
+
start_from: int, optional defaults to 0
|
2206
|
+
The page number to start retrieving elements from
|
2207
|
+
page_size : int, optional defaults to None
|
2208
|
+
The number of elements to retrieve
|
2209
|
+
Returns
|
2210
|
+
-------
|
2211
|
+
dict
|
2212
|
+
The glossary definition associated with the glossary_guid
|
2213
|
+
|
2214
|
+
Raises
|
2215
|
+
------
|
2216
|
+
InvalidParameterException
|
2217
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2218
|
+
PropertyServerException
|
2219
|
+
Raised by the server when an issue arises in processing a valid request.
|
2220
|
+
NotAuthorizedException
|
2221
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2222
|
+
Notes
|
2223
|
+
-----
|
2224
|
+
"""
|
2225
|
+
loop = asyncio.get_event_loop()
|
2226
|
+
response = loop.run_until_complete(
|
2227
|
+
self._async_get_term_relationships(term_guid, server_name, effective_time, start_from, page_size))
|
2228
|
+
|
2229
|
+
return response
|
2230
|
+
|
2231
|
+
async def _async_get_glossary_for_term(self, term_guid: str, server_name: str = None,
|
2232
|
+
effective_time: str = None) -> dict | str:
|
2233
|
+
""" Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
|
2234
|
+
that the glossary element should only be returned if it was effective at a particular time.
|
2235
|
+
|
2236
|
+
Async Version.
|
2237
|
+
|
2238
|
+
Parameters
|
2239
|
+
----------
|
2240
|
+
term_guid : str
|
2241
|
+
The unique identifier for the term.
|
2242
|
+
server_name : str, optional
|
2243
|
+
The name of the server. If not specified, the default server name will be used.
|
2244
|
+
effective_time : datetime, optional
|
2245
|
+
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
2246
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2247
|
+
|
2248
|
+
Returns
|
2249
|
+
-------
|
2250
|
+
dict
|
2251
|
+
The glossary information retrieved for the specified term.
|
2252
|
+
Raises
|
2253
|
+
------
|
2254
|
+
InvalidParameterException
|
2255
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2256
|
+
PropertyServerException
|
2257
|
+
Raised by the server when an issue arises in processing a valid request.
|
2258
|
+
NotAuthorizedException
|
2259
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2260
|
+
Notes
|
2261
|
+
-----
|
2262
|
+
"""
|
2263
|
+
if server_name is None:
|
2264
|
+
server_name = self.server_name
|
2265
|
+
validate_guid(term_guid)
|
2266
|
+
|
2267
|
+
body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
|
2268
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
2269
|
+
f"for-term/{term_guid}/retrieve")
|
2270
|
+
|
2271
|
+
response = await self._async_make_request("POST", url, body)
|
2272
|
+
return response.json().get("element", "No glossary found")
|
2273
|
+
|
2274
|
+
def get_glossary_for_term(self, term_guid: str, server_name: str = None,
|
2275
|
+
effective_time: str = None) -> dict | str:
|
2276
|
+
""" Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
|
2277
|
+
that the glossary element should only be returned if it was effective at a particular time.
|
2278
|
+
|
2279
|
+
Async Version.
|
2280
|
+
|
2281
|
+
Parameters
|
2282
|
+
----------
|
2283
|
+
term_guid : str
|
2284
|
+
The unique identifier for the term.
|
2285
|
+
server_name : str, optional
|
2286
|
+
The name of the server. If not specified, the default server name will be used.
|
2287
|
+
effective_time : datetime, optional
|
2288
|
+
TIf specified, the term information will be retrieved if it is active at the `effective_time`.
|
2289
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
|
2290
|
+
|
2291
|
+
Returns
|
2292
|
+
-------
|
2293
|
+
dict
|
2294
|
+
The glossary information retrieved for the specified term.
|
2295
|
+
Raises
|
2296
|
+
------
|
2297
|
+
InvalidParameterException
|
2298
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2299
|
+
PropertyServerException
|
2300
|
+
Raised by the server when an issue arises in processing a valid request.
|
2301
|
+
NotAuthorizedException
|
2302
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2303
|
+
Notes
|
2304
|
+
-----
|
2305
|
+
"""
|
2306
|
+
loop = asyncio.get_event_loop()
|
2307
|
+
response = loop.run_until_complete(self._async_get_glossary_for_term(term_guid, server_name, effective_time))
|
2308
|
+
return response
|
2309
|
+
|
2310
|
+
async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
|
2311
|
+
server_name: str = None, effective_time: str = None,
|
2312
|
+
for_lineage: bool = False, for_duplicate_processing: bool = False,
|
2313
|
+
start_from: int = 0, page_size: int = None) -> list:
|
2314
|
+
""" Retrieve glossary terms by display name or qualified name. Async Version.
|
2315
|
+
|
2316
|
+
Parameters
|
2317
|
+
----------
|
2318
|
+
term : str
|
2319
|
+
The term to search for in the glossaries.
|
2320
|
+
glossary_guid : str, optional
|
2321
|
+
The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
|
2322
|
+
status_filter : list, optional
|
2323
|
+
A list of status values to filter the search results. Default is an empty list, which means no filtering.
|
2324
|
+
server_name : str, optional
|
2325
|
+
The name of the server where the glossaries reside. If not provided, it will use the default server name.
|
2326
|
+
effective_time : datetime, optional
|
2327
|
+
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
2328
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2329
|
+
for_lineage : bool, optional
|
2330
|
+
Flag to indicate whether the search should include lineage information. Default is False.
|
2331
|
+
for_duplicate_processing : bool, optional
|
2332
|
+
Flag to indicate whether the search should include duplicate processing information. Default is False.
|
2333
|
+
start_from : int, optional
|
2334
|
+
The index of the first term to retrieve. Default is 0.
|
2335
|
+
page_size : int, optional
|
2336
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2337
|
+
|
2338
|
+
Returns
|
2339
|
+
-------
|
2340
|
+
list
|
2341
|
+
A list of terms matching the search criteria. If no terms are found, it returns the string "No terms found".
|
2342
|
+
|
2343
|
+
Raises
|
2344
|
+
------
|
2345
|
+
InvalidParameterException
|
2346
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2347
|
+
PropertyServerException
|
2348
|
+
Raised by the server when an issue arises in processing a valid request.
|
2349
|
+
NotAuthorizedException
|
2350
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2351
|
+
"""
|
2352
|
+
if server_name is None:
|
2353
|
+
server_name = self.server_name
|
2354
|
+
if page_size is None:
|
2355
|
+
page_size = self.page_size
|
2356
|
+
|
2357
|
+
validate_name(term)
|
2358
|
+
|
2359
|
+
for_lineage_s = str(for_lineage).lower()
|
2360
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2361
|
+
|
2362
|
+
body = {"class": "GlossaryNameRequestBody", "glossaryGUID": glossary_guid, "name": term,
|
2363
|
+
"effectiveTime": effective_time, "limitResultsByStatus": status_filter}
|
2364
|
+
# body = body_slimmer(body)
|
2365
|
+
|
2366
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
2367
|
+
f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
|
2368
|
+
f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
|
2369
|
+
|
2370
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2371
|
+
|
2372
|
+
response = await self._async_make_request("POST", url, body)
|
2373
|
+
return response.json().get("elementList", "No terms found")
|
2374
|
+
|
2375
|
+
def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [], server_name: str = None,
|
2376
|
+
effective_time: str = None, for_lineage: bool = False,
|
2377
|
+
for_duplicate_processing: bool = False, start_from: int = 0, page_size: int = None) -> list:
|
2378
|
+
""" Retrieve glossary terms by display name or qualified name.
|
2379
|
+
|
2380
|
+
Parameters
|
2381
|
+
----------
|
2382
|
+
term : str
|
2383
|
+
The term to search for in the glossaries.
|
2384
|
+
glossary_guid : str, optional
|
2385
|
+
The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
|
2386
|
+
status_filter : list, optional
|
2387
|
+
A list of status values to filter the search results. Default is an empty list, which means no filtering.
|
2388
|
+
server_name : str, optional
|
2389
|
+
The name of the server where the glossaries reside. If not provided, it will use the default server name.
|
2390
|
+
effective_time : datetime, optional
|
2391
|
+
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
2392
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2393
|
+
for_lineage : bool, optional
|
2394
|
+
Flag to indicate whether the search should include lineage information. Default is False.
|
2395
|
+
for_duplicate_processing : bool, optional
|
2396
|
+
Flag to indicate whether the search should include duplicate processing information. Default is False.
|
2397
|
+
start_from : int, optional
|
2398
|
+
The index of the first term to retrieve. Default is 0.
|
2399
|
+
page_size : int, optional
|
2400
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2401
|
+
|
2402
|
+
Returns
|
2403
|
+
-------
|
2404
|
+
list
|
2405
|
+
A list of terms matching the search criteria. If no terms are found,
|
2406
|
+
it returns the string "No terms found".
|
2407
|
+
|
2408
|
+
Raises
|
2409
|
+
------
|
2410
|
+
InvalidParameterException
|
2411
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2412
|
+
PropertyServerException
|
2413
|
+
Raised by the server when an issue arises in processing a valid request.
|
2414
|
+
NotAuthorizedException
|
2415
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2416
|
+
"""
|
2417
|
+
loop = asyncio.get_event_loop()
|
2418
|
+
response = loop.run_until_complete(
|
2419
|
+
self._async_get_terms_by_name(term, glossary_guid, status_filter, server_name, effective_time, for_lineage,
|
2420
|
+
for_duplicate_processing, start_from, page_size))
|
2421
|
+
return response
|
2422
|
+
|
2423
|
+
async def _async_get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
|
2424
|
+
""" Retrieve a term using its unique id. Async version.
|
2425
|
+
Parameters
|
2426
|
+
----------
|
2427
|
+
term_guid : str
|
2428
|
+
The GUID of the glossary term to retrieve.
|
2429
|
+
server_name : str, optional
|
2430
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2431
|
+
|
2432
|
+
Returns
|
2433
|
+
-------
|
2434
|
+
dict | str
|
2435
|
+
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
2436
|
+
"No term found" will be returned.
|
2437
|
+
|
2438
|
+
Raises
|
2439
|
+
------
|
2440
|
+
InvalidParameterException
|
2441
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2442
|
+
PropertyServerException
|
2443
|
+
Raised by the server when an issue arises in processing a valid request.
|
2444
|
+
NotAuthorizedException
|
2445
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2446
|
+
"""
|
2447
|
+
if server_name is None:
|
2448
|
+
server_name = self.server_name
|
2449
|
+
|
2450
|
+
validate_guid(term_guid)
|
2451
|
+
|
2452
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
|
2453
|
+
f"{term_guid}/retrieve")
|
2454
|
+
|
2455
|
+
response = await self._async_make_request("POST", url)
|
2456
|
+
return response.json().get("element", "No term found")
|
2457
|
+
|
2458
|
+
def get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
|
2459
|
+
""" Retrieve a term using its unique id. Async version.
|
2460
|
+
Parameters
|
2461
|
+
----------
|
2462
|
+
term_guid : str
|
2463
|
+
The GUID of the glossary term to retrieve.
|
2464
|
+
server_name : str, optional
|
2465
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2466
|
+
|
2467
|
+
Returns
|
2468
|
+
-------
|
2469
|
+
dict | str
|
2470
|
+
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
2471
|
+
"No term found" will be returned.
|
2472
|
+
|
2473
|
+
Raises
|
2474
|
+
------
|
2475
|
+
InvalidParameterException
|
2476
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2477
|
+
PropertyServerException
|
2478
|
+
Raised by the server when an issue arises in processing a valid request.
|
2479
|
+
NotAuthorizedException
|
2480
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2481
|
+
"""
|
2482
|
+
|
2483
|
+
loop = asyncio.get_event_loop()
|
2484
|
+
response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid, server_name))
|
2485
|
+
|
2486
|
+
return response
|
2487
|
+
|
2488
|
+
async def _async_get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
|
2489
|
+
page_size=None) -> dict | str:
|
2490
|
+
""" Retrieve the versions of a glossary term. Async version.
|
2491
|
+
Parameters
|
2492
|
+
----------
|
2493
|
+
term_guid : str
|
2494
|
+
The GUID of the glossary term to retrieve.
|
2495
|
+
server_name : str, optional
|
2496
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2497
|
+
start_from : int, optional
|
2498
|
+
The index of the first term to retrieve. Default is 0.
|
2499
|
+
page_size : int, optional
|
2500
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2501
|
+
Returns
|
2502
|
+
-------
|
2503
|
+
dict | str
|
2504
|
+
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
2505
|
+
"No term found" will be returned.
|
2506
|
+
|
2507
|
+
Raises
|
2508
|
+
------
|
2509
|
+
InvalidParameterException
|
2510
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2511
|
+
PropertyServerException
|
2512
|
+
Raised by the server when an issue arises in processing a valid request.
|
2513
|
+
NotAuthorizedException
|
2514
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2515
|
+
"""
|
2516
|
+
if server_name is None:
|
2517
|
+
server_name = self.server_name
|
2518
|
+
|
2519
|
+
if page_size is None:
|
2520
|
+
page_size = self.page_size
|
2521
|
+
|
2522
|
+
validate_guid(term_guid)
|
2523
|
+
|
2524
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
|
2525
|
+
f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}")
|
2526
|
+
|
2527
|
+
response = await self._async_make_request("POST", url)
|
2528
|
+
return response.json().get("element", "No term found")
|
2529
|
+
|
2530
|
+
def get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
|
2531
|
+
page_size=None) -> dict | str:
|
2532
|
+
""" Retrieve the versions of a glossary term.
|
2533
|
+
Parameters
|
2534
|
+
----------
|
2535
|
+
term_guid : str
|
2536
|
+
The GUID of the glossary term to retrieve.
|
2537
|
+
server_name : str, optional
|
2538
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2539
|
+
start_from : int, optional
|
2540
|
+
The index of the first term to retrieve. Default is 0.
|
2541
|
+
page_size : int, optional
|
2542
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2543
|
+
Returns
|
2544
|
+
-------
|
2545
|
+
dict | str
|
2546
|
+
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
2547
|
+
"No term found" will be returned.
|
2548
|
+
|
2549
|
+
Raises
|
2550
|
+
------
|
2551
|
+
InvalidParameterException
|
2552
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2553
|
+
PropertyServerException
|
2554
|
+
Raised by the server when an issue arises in processing a valid request.
|
2555
|
+
NotAuthorizedException
|
2556
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2557
|
+
"""
|
2558
|
+
|
2559
|
+
loop = asyncio.get_event_loop()
|
2560
|
+
response = loop.run_until_complete(
|
2561
|
+
self._async_get_terms_versions(term_guid, server_name, start_from, page_size))
|
2562
|
+
|
2563
|
+
return response
|
2564
|
+
|
2565
|
+
async def _async_get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
|
2566
|
+
page_size=None) -> dict | str:
|
2567
|
+
""" Retrieve the revision log history for a term. Async version.
|
2568
|
+
Parameters
|
2569
|
+
----------
|
2570
|
+
term_guid : str
|
2571
|
+
The GUID of the glossary term to retrieve.
|
2572
|
+
server_name : str, optional
|
2573
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2574
|
+
start_from : int, optional
|
2575
|
+
The index of the first term to retrieve. Default is 0.
|
2576
|
+
page_size : int, optional
|
2577
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2578
|
+
Returns
|
2579
|
+
-------
|
2580
|
+
dict | str
|
2581
|
+
A dict detailing the glossary term revision log history. If no term is found, the string
|
2582
|
+
"No log found" will be returned.
|
2583
|
+
|
2584
|
+
Raises
|
2585
|
+
------
|
2586
|
+
InvalidParameterException
|
2587
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2588
|
+
PropertyServerException
|
2589
|
+
Raised by the server when an issue arises in processing a valid request.
|
2590
|
+
NotAuthorizedException
|
2591
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2592
|
+
"""
|
2593
|
+
if server_name is None:
|
2594
|
+
server_name = self.server_name
|
2595
|
+
|
2596
|
+
if page_size is None:
|
2597
|
+
page_size = self.page_size
|
2598
|
+
|
2599
|
+
validate_guid(term_guid)
|
2600
|
+
|
2601
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
|
2602
|
+
f"{term_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
|
2603
|
+
|
2604
|
+
response = await self._async_make_request("POST", url)
|
2605
|
+
return response.json().get("elementList", "No log found")
|
2606
|
+
|
2607
|
+
def get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
|
2608
|
+
page_size=None) -> dict | str:
|
2609
|
+
""" Retrieve the revision log history for a term.
|
2610
|
+
Parameters
|
2611
|
+
----------
|
2612
|
+
term_guid : str
|
2613
|
+
The GUID of the glossary term to retrieve.
|
2614
|
+
server_name : str, optional
|
2615
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2616
|
+
start_from : int, optional
|
2617
|
+
The index of the first term to retrieve. Default is 0.
|
2618
|
+
page_size : int, optional
|
2619
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2620
|
+
Returns
|
2621
|
+
-------
|
2622
|
+
dict | str
|
2623
|
+
A dict detailing the glossary term revision log history. If no term is found, the string
|
2624
|
+
"No log found" will be returned.
|
2625
|
+
|
2626
|
+
Raises
|
2627
|
+
------
|
2628
|
+
InvalidParameterException
|
2629
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2630
|
+
PropertyServerException
|
2631
|
+
Raised by the server when an issue arises in processing a valid request.
|
2632
|
+
NotAuthorizedException
|
2633
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2634
|
+
"""
|
2635
|
+
|
2636
|
+
loop = asyncio.get_event_loop()
|
2637
|
+
response = loop.run_until_complete(
|
2638
|
+
self._async_get_term_revision_logs(term_guid, server_name, start_from, page_size))
|
2639
|
+
|
2640
|
+
return response
|
2641
|
+
|
2642
|
+
async def _async_get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None,
|
2643
|
+
start_from: int = 0, page_size=None) -> dict | str:
|
2644
|
+
""" Retrieve the revision history for a glossary term. Async version.
|
2645
|
+
|
2646
|
+
Parameters
|
2647
|
+
----------
|
2648
|
+
term_revision_log_guid : str
|
2649
|
+
The GUID of the glossary term revision log to retrieve.
|
2650
|
+
server_name : str, optional
|
2651
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2652
|
+
start_from : int, optional
|
2653
|
+
The index of the first term to retrieve. Default is 0.
|
2654
|
+
page_size : int, optional
|
2655
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2656
|
+
Returns
|
2657
|
+
-------
|
2658
|
+
dict | str
|
2659
|
+
A dict detailing the glossary term revision history.
|
2660
|
+
|
2661
|
+
Raises
|
2662
|
+
------
|
2663
|
+
InvalidParameterException
|
2664
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2665
|
+
PropertyServerException
|
2666
|
+
Raised by the server when an issue arises in processing a valid request.
|
2667
|
+
NotAuthorizedException
|
2668
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2669
|
+
|
2670
|
+
|
2671
|
+
Notes
|
2672
|
+
-----
|
2673
|
+
This revision history is created automatically. The text is supplied on the update request.
|
2674
|
+
If no text is supplied, the value "None" is show.
|
2675
|
+
"""
|
2676
|
+
if server_name is None:
|
2677
|
+
server_name = self.server_name
|
2678
|
+
|
2679
|
+
if page_size is None:
|
2680
|
+
page_size = self.page_size
|
2681
|
+
|
2682
|
+
validate_guid(term_revision_log_guid)
|
2683
|
+
|
2684
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/note-logs/"
|
2685
|
+
f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
|
2686
|
+
|
2687
|
+
response = await self._async_make_request("POST", url)
|
2688
|
+
return response.json().get("elementList", "No logs found")
|
2689
|
+
|
2690
|
+
def get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None, start_from: int = 0,
|
2691
|
+
page_size=None) -> dict | str:
|
2692
|
+
""" Retrieve the revision history for a glossary term.
|
2693
|
+
|
2694
|
+
Parameters
|
2695
|
+
----------
|
2696
|
+
term_revision_log_guid : str
|
2697
|
+
The GUID of the glossary term revision log to retrieve.
|
2698
|
+
server_name : str, optional
|
2699
|
+
The name of the server to connect to. If not provided, the default server name will be used.
|
2700
|
+
start_from : int, optional
|
2701
|
+
The index of the first term to retrieve. Default is 0.
|
2702
|
+
page_size : int, optional
|
2703
|
+
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
2704
|
+
Returns
|
2705
|
+
-------
|
2706
|
+
dict | str
|
2707
|
+
A dict detailing the glossary term revision history.
|
2708
|
+
|
2709
|
+
Raises
|
2710
|
+
------
|
2711
|
+
InvalidParameterException
|
2712
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
2713
|
+
PropertyServerException
|
2714
|
+
Raised by the server when an issue arises in processing a valid request.
|
2715
|
+
NotAuthorizedException
|
2716
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
2717
|
+
|
2718
|
+
|
2719
|
+
Notes
|
2720
|
+
-----
|
2721
|
+
This revision history is created automatically. The text is supplied on the update request.
|
2722
|
+
If no text is supplied, the value "None" is show.
|
2723
|
+
"""
|
2724
|
+
|
2725
|
+
loop = asyncio.get_event_loop()
|
2726
|
+
response = loop.run_until_complete(
|
2727
|
+
self._async_get_term_revision_history(term_revision_log_guid, server_name, start_from, page_size))
|
2728
|
+
|
2729
|
+
return response
|
2730
|
+
|
2731
|
+
async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
2732
|
+
effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
|
2733
|
+
ignore_case: bool = False, for_lineage: bool = False,
|
2734
|
+
for_duplicate_processing: bool = False, server_name: str = None,
|
2735
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
2736
|
+
|
2737
|
+
""" Retrieve the list of glossary term metadata elements that contain the search string.
|
2738
|
+
|
2739
|
+
Parameters
|
2740
|
+
----------
|
2741
|
+
search_string: str
|
2742
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
2743
|
+
glossary_guid str
|
2744
|
+
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
2745
|
+
status_filter: list, default = [], optional
|
2746
|
+
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
2747
|
+
the results will not be filtered.
|
2748
|
+
effective_time: str, [default=None], optional
|
2749
|
+
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
2750
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2751
|
+
server_name : str, optional
|
2752
|
+
The name of the server to configure.
|
2753
|
+
If not provided, the server name associated with the instance is used.
|
2754
|
+
starts_with : bool, [default=False], optional
|
2755
|
+
Starts with the supplied string.
|
2756
|
+
ends_with : bool, [default=False], optional
|
2757
|
+
Ends with the supplied string
|
2758
|
+
ignore_case : bool, [default=False], optional
|
2759
|
+
Ignore case when searching
|
2760
|
+
for_lineage : bool, [default=False], optional
|
2761
|
+
|
2762
|
+
for_duplicate_processing : bool, [default=False], optional
|
2763
|
+
|
2764
|
+
start_from: str, [default=0], optional
|
2765
|
+
Page of results to start from
|
2766
|
+
page_size : int, optional
|
2767
|
+
Number of elements to return per page - if None, then default for class will be used.
|
2768
|
+
|
2769
|
+
Returns
|
2770
|
+
-------
|
2771
|
+
List | str
|
2772
|
+
|
2773
|
+
A list of term definitions
|
2774
|
+
|
2775
|
+
Raises
|
2776
|
+
------
|
2777
|
+
InvalidParameterException
|
2778
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2779
|
+
PropertyServerException
|
2780
|
+
Raised by the server when an issue arises in processing a valid request
|
2781
|
+
NotAuthorizedException
|
2782
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2783
|
+
|
2784
|
+
Notes
|
2785
|
+
-----
|
2786
|
+
The search string is located in the request body and is interpreted as a plain string.
|
2787
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
2788
|
+
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
2789
|
+
"""
|
2790
|
+
if server_name is None:
|
2791
|
+
server_name = self.server_name
|
2792
|
+
if page_size is None:
|
2793
|
+
page_size = self.page_size
|
2794
|
+
if effective_time is None:
|
2795
|
+
effective_time = datetime.now().isoformat()
|
2796
|
+
starts_with_s = str(starts_with).lower()
|
2797
|
+
ends_with_s = str(ends_with).lower()
|
2798
|
+
ignore_case_s = str(ignore_case).lower()
|
2799
|
+
for_lineage_s = str(for_lineage).lower()
|
2800
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2801
|
+
if search_string == '*':
|
2802
|
+
search_string = None
|
2803
|
+
|
2804
|
+
# validate_search_string(search_string)
|
2805
|
+
|
2806
|
+
body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
|
2807
|
+
"searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
|
2808
|
+
# body = body_slimmer(body)
|
2809
|
+
|
2810
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
2811
|
+
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
2812
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
2813
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
2814
|
+
|
2815
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2816
|
+
|
2817
|
+
response = await self._async_make_request("POST", url, body)
|
2818
|
+
return response.json().get("elementList", "No terms found") # return response.text
|
2819
|
+
|
2820
|
+
def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
2821
|
+
effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
|
2822
|
+
ignore_case: bool = False, for_lineage: bool = False,
|
2823
|
+
for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
|
2824
|
+
page_size: int = None) -> list | str:
|
2825
|
+
""" Retrieve the list of glossary term metadata elements that contain the search string.
|
2826
|
+
|
2827
|
+
Parameters
|
2828
|
+
----------
|
2829
|
+
search_string: str
|
2830
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
2831
|
+
glossary_guid str
|
2832
|
+
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
2833
|
+
status_filter: list, default = [], optional
|
2834
|
+
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
2835
|
+
the results will not be filtered.
|
2836
|
+
effective_time: str, [default=None], optional
|
2837
|
+
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
2838
|
+
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2839
|
+
server_name : str, optional
|
2840
|
+
The name of the server to configure.
|
2841
|
+
If not provided, the server name associated with the instance is used.
|
2842
|
+
starts_with : bool, [default=False], optional
|
2843
|
+
Starts with the supplied string.
|
2844
|
+
ends_with : bool, [default=False], optional
|
2845
|
+
Ends with the supplied string
|
2846
|
+
ignore_case : bool, [default=False], optional
|
2847
|
+
Ignore case when searching
|
2848
|
+
for_lineage : bool, [default=False], optional
|
2849
|
+
|
2850
|
+
for_duplicate_processing : bool, [default=False], optional
|
2851
|
+
|
2852
|
+
start_from: str, [default=0], optional
|
2853
|
+
Page of results to start from
|
2854
|
+
page_size : int, optional
|
2855
|
+
Number of elements to return per page - if None, then default for class will be used.
|
2856
|
+
|
2857
|
+
Returns
|
2858
|
+
-------
|
2859
|
+
List | str
|
2860
|
+
|
2861
|
+
A list of term definitions
|
2862
|
+
|
2863
|
+
Raises
|
2864
|
+
------
|
2865
|
+
InvalidParameterException
|
2866
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2867
|
+
PropertyServerException
|
2868
|
+
Raised by the server when an issue arises in processing a valid request
|
2869
|
+
NotAuthorizedException
|
2870
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2871
|
+
|
2872
|
+
Notes
|
2873
|
+
-----
|
2874
|
+
The search string is located in the request body and is interpreted as a plain string.
|
2875
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
2876
|
+
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
2877
|
+
"""
|
2878
|
+
|
2879
|
+
loop = asyncio.get_event_loop()
|
2880
|
+
response = loop.run_until_complete(
|
2881
|
+
self._async_find_glossary_terms(search_string, glossary_guid, status_filter, effective_time, starts_with,
|
2882
|
+
ends_with, ignore_case, for_lineage, for_duplicate_processing, server_name,
|
2883
|
+
start_from, page_size))
|
2884
|
+
|
2885
|
+
return response
|
2886
|
+
|
2887
|
+
#
|
2888
|
+
# Feedback
|
2889
|
+
#
|
2890
|
+
async def _async_get_comment(self, commemtGUID: str, effective_time: str, server_name: str = None,
|
2891
|
+
for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict | list:
|
2892
|
+
""" Retrieve the comment specified by the comment GUID """
|
2893
|
+
if server_name is None:
|
2894
|
+
server_name = self.server_name
|
2895
|
+
|
2896
|
+
validate_guid(commemtGUID)
|
2897
|
+
|
2898
|
+
if effective_time is None:
|
2899
|
+
effective_time = datetime.now().isoformat()
|
2900
|
+
|
2901
|
+
for_lineage_s = str(for_lineage).lower()
|
2902
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2903
|
+
|
2904
|
+
body = {"effective_time": effective_time}
|
2905
|
+
|
2906
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
2907
|
+
f"{commemtGUID}?forLineage={for_lineage_s}&"
|
2908
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
2909
|
+
|
2910
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2911
|
+
|
2912
|
+
response = await self._async_make_request("POST", url, body)
|
2913
|
+
return response.json()
|
2914
|
+
|
2915
|
+
async def _async_add_comment_reply(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
2916
|
+
server_name: str = None, for_lineage: bool = False,
|
2917
|
+
for_duplicate_processing: bool = False) -> str:
|
2918
|
+
""" Reply to a comment """
|
2919
|
+
|
2920
|
+
if server_name is None:
|
2921
|
+
server_name = self.server_name
|
2922
|
+
|
2923
|
+
validate_guid(commentGUID)
|
2924
|
+
validate_name(comment_type)
|
2925
|
+
|
2926
|
+
is_public_s = str(is_public).lower()
|
2927
|
+
for_lineage_s = str(for_lineage).lower()
|
2928
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2929
|
+
|
2930
|
+
body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
|
2931
|
+
"isPublic": is_public}
|
2932
|
+
|
2933
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
2934
|
+
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
2935
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
2936
|
+
|
2937
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2938
|
+
|
2939
|
+
response = await self._async_make_request("POST", url, body)
|
2940
|
+
return response
|
2941
|
+
|
2942
|
+
async def _async_update_comment(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
2943
|
+
server_name: str = None, is_merge_update: bool = False, for_lineage: bool = False,
|
2944
|
+
for_duplicate_processing: bool = False) -> str:
|
2945
|
+
""" Update the specified comment"""
|
2946
|
+
if server_name is None:
|
2947
|
+
server_name = self.server_name
|
2948
|
+
|
2949
|
+
validate_guid(commentGUID)
|
2950
|
+
validate_name(comment_type)
|
2951
|
+
|
2952
|
+
is_public_s = str(is_public).lower()
|
2953
|
+
for_lineage_s = str(for_lineage).lower()
|
2954
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2955
|
+
|
2956
|
+
body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
|
2957
|
+
"isPublic": is_public}
|
2958
|
+
|
2959
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
2960
|
+
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
2961
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
2962
|
+
|
2963
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2964
|
+
|
2965
|
+
response = await self._async_make_request("POST", url, body)
|
2966
|
+
return response
|
2967
|
+
|
2968
|
+
async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
2969
|
+
effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
|
2970
|
+
ignore_case: bool = False, for_lineage: bool = False,
|
2971
|
+
for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
|
2972
|
+
page_size: int = None):
|
2973
|
+
"""Find comments by search string"""
|
2974
|
+
if server_name is None:
|
2975
|
+
server_name = self.server_name
|
2976
|
+
if page_size is None:
|
2977
|
+
page_size = self.page_size
|
2978
|
+
if effective_time is None:
|
2979
|
+
effective_time = datetime.now().isoformat()
|
2980
|
+
starts_with_s = str(starts_with).lower()
|
2981
|
+
ends_with_s = str(ends_with).lower()
|
2982
|
+
ignore_case_s = str(ignore_case).lower()
|
2983
|
+
for_lineage_s = str(for_lineage).lower()
|
2984
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
2985
|
+
if search_string == '*':
|
2986
|
+
search_string = None
|
2987
|
+
|
2988
|
+
# validate_search_string(search_string)
|
2989
|
+
|
2990
|
+
body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
|
2991
|
+
"searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
|
2992
|
+
# body = body_slimmer(body)
|
2993
|
+
|
2994
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
2995
|
+
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
2996
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
2997
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
2998
|
+
|
2999
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
3000
|
+
|
3001
|
+
response = await self._async_make_request("POST", url, body)
|
3002
|
+
return response.json().get("elementList", "No terms found")
|