pyegeria 5.4.0.25__py3-none-any.whl → 5.4.0.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commands/cat/debug_log +868 -7794
- commands/cat/debug_log.2025-08-18_11-34-38_088636.zip +0 -0
- commands/cat/list_collections.py +1 -1
- commands/cat/list_format_set.py +6 -8
- commands/cli/egeria.py +2 -2
- commands/cli/egeria_cat.py +3 -2
- commands/ops/load_archive.py +2 -2
- md_processing/data/commands.json +7 -7
- md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +7 -7
- md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +36 -31
- md_processing/dr_egeria_outbox/friday/processed-2025-08-22 21:22-dr_egeria_intro_part1.md +312 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-22 21:23-dr_egeria_intro_part1.md +265 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-23 15:06-dr_egeria_intro_part1.md +230 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-23 15:30-dr_egeria_intro_part1.md +296 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-23 15:31-dr_egeria_intro_part1.md +253 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-23 16:08-dr_egeria_intro_part2.md +343 -0
- md_processing/dr_egeria_outbox/friday/processed-2025-08-23 16:12-dr_egeria_intro_part2.md +343 -0
- md_processing/md_commands/glossary_commands.py +888 -951
- md_processing/md_commands/product_manager_commands.py +8 -270
- md_processing/md_commands/project_commands.py +1 -1
- md_processing/md_processing_utils/common_md_proc_utils.py +138 -64
- md_processing/md_processing_utils/common_md_utils.py +2 -1
- pyegeria/__init__.py +5 -302
- pyegeria/_client_new.py +5 -4
- pyegeria/_output_formats.py +23 -3
- pyegeria/collection_manager.py +31 -28
- pyegeria/{load_config.py → config.py} +7 -2
- pyegeria/data_designer.py +154 -194
- pyegeria/egeria_cat_client.py +48 -30
- pyegeria/egeria_client.py +74 -75
- pyegeria/egeria_config_client.py +37 -7
- pyegeria/egeria_my_client.py +45 -10
- pyegeria/egeria_tech_client.py +69 -58
- pyegeria/glossary_manager.py +494 -122
- pyegeria/governance_officer.py +2 -2
- pyegeria/logging_configuration.py +1 -4
- pyegeria/models.py +1 -1
- pyegeria/project_manager.py +381 -741
- pyegeria/solution_architect_omvs.py +1 -1
- pyegeria/utils.py +1 -3
- {pyegeria-5.4.0.25.dist-info → pyegeria-5.4.0.27.dist-info}/METADATA +1 -1
- {pyegeria-5.4.0.25.dist-info → pyegeria-5.4.0.27.dist-info}/RECORD +45 -44
- commands/cat/debug_log.2025-08-15_09-14-07_444802.zip +0 -0
- commands/cat/debug_log.2025-08-16_10-21-59_388912.zip +0 -0
- commands/cat/debug_log.2025-08-17_11-34-27_981852.zip +0 -0
- md_processing/md_processing_utils/solution_architect_log.log +0 -0
- pyegeria/collection_manager_omvs.py +0 -6541
- pyegeria/glossary_browser.py +0 -1259
- pyegeria/project_manager_omvs.py +0 -1933
- {pyegeria-5.4.0.25.dist-info → pyegeria-5.4.0.27.dist-info}/LICENSE +0 -0
- {pyegeria-5.4.0.25.dist-info → pyegeria-5.4.0.27.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.0.25.dist-info → pyegeria-5.4.0.27.dist-info}/entry_points.txt +0 -0
pyegeria/glossary_browser.py
DELETED
@@ -1,1259 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
PDX-License-Identifier: Apache-2.0
|
3
|
-
Copyright Contributors to the ODPi Egeria project.
|
4
|
-
|
5
|
-
This module contains an initial version of the glossary_browser omvs module. There are additional methods that will be
|
6
|
-
added in subsequent versions of the glossary_omvs module.
|
7
|
-
|
8
|
-
"""
|
9
|
-
|
10
|
-
import asyncio
|
11
|
-
from datetime import datetime
|
12
|
-
|
13
|
-
from pyegeria import NO_GLOSSARIES_FOUND, max_paging_size
|
14
|
-
from pyegeria._client_new import Client2
|
15
|
-
from pyegeria._exceptions import InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
16
|
-
from pyegeria._globals import NO_CATEGORIES_FOUND, NO_TERMS_FOUND
|
17
|
-
from pyegeria._validators import validate_guid, validate_name, validate_search_string
|
18
|
-
from pyegeria.models import GetRequestBody
|
19
|
-
from pyegeria.utils import body_slimmer
|
20
|
-
from pyegeria._output_formats import select_output_format_set, get_output_format_type_match
|
21
|
-
from loguru import logger
|
22
|
-
from pydantic import ValidationError, Field, HttpUrl
|
23
|
-
|
24
|
-
from pyegeria._exceptions_new import PyegeriaInvalidParameterException
|
25
|
-
from pyegeria._globals import NO_ELEMENTS_FOUND, NO_GUID_RETURNED, NO_MEMBERS_FOUND
|
26
|
-
from pyegeria._output_formats import select_output_format_set, get_output_format_type_match
|
27
|
-
from pyegeria.load_config import get_app_config
|
28
|
-
from pyegeria.models import (SearchStringRequestBody, FilterRequestBody, GetRequestBody, NewElementRequestBody,
|
29
|
-
ReferenceableProperties, InitialClassifications, TemplateRequestBody,
|
30
|
-
UpdateElementRequestBody, UpdateStatusRequestBody, NewRelationshipRequestBody,
|
31
|
-
DeleteRequestBody, UpdateRelationshipRequestBody, ResultsRequestBody,
|
32
|
-
get_defined_field_values, PyegeriaModel)
|
33
|
-
from pyegeria.output_formatter import (generate_output,
|
34
|
-
_extract_referenceable_properties, populate_columns_from_properties,
|
35
|
-
get_required_relationships)
|
36
|
-
from pyegeria.utils import body_slimmer, dynamic_catch
|
37
|
-
|
38
|
-
|
39
|
-
class GlossaryBrowser(Client2):
|
40
|
-
"""
|
41
|
-
GlossaryBrowser is a class that extends the Client class. It provides methods to search and retrieve glossaries,
|
42
|
-
terms, and categories.
|
43
|
-
|
44
|
-
Attributes:
|
45
|
-
|
46
|
-
view_server: str
|
47
|
-
The name of the View Server to connect to.
|
48
|
-
platform_url : str
|
49
|
-
URL of the server platform to connect to
|
50
|
-
user_id : str
|
51
|
-
The identity of the user calling the method - this sets a default optionally used by the methods
|
52
|
-
when the user doesn't pass the user_id on a method call.
|
53
|
-
user_pwd: str
|
54
|
-
The password associated with the user_id. Defaults to None
|
55
|
-
|
56
|
-
"""
|
57
|
-
|
58
|
-
def __init__(self, view_server: str, platform_url: str, user_id: str, user_pwd: str = None, token: str = None, ):
|
59
|
-
self.view_server = view_server
|
60
|
-
self.platform_url = platform_url
|
61
|
-
self.user_pwd = user_pwd
|
62
|
-
self.user_id = user_id
|
63
|
-
self.g_browser_command_root: str
|
64
|
-
|
65
|
-
Client2.__init__(self, view_server, platform_url, user_id, user_pwd, token)
|
66
|
-
|
67
|
-
|
68
|
-
def _extract_glossary_properties(self, element: dict, columns_struct: dict) -> dict:
|
69
|
-
"""
|
70
|
-
Extract and populate glossary properties into columns_struct following the unified output_formatter pattern.
|
71
|
-
|
72
|
-
Args:
|
73
|
-
element (dict): The glossary element returned by the OMVS (contains 'glossaryProperties').
|
74
|
-
columns_struct (dict): The columns structure to populate.
|
75
|
-
|
76
|
-
Returns:
|
77
|
-
dict: columns_struct with populated 'value' fields
|
78
|
-
"""
|
79
|
-
# Normalize properties for populate_columns_from_properties (expects element['properties'])
|
80
|
-
props = element.get('properties', {}) or {}
|
81
|
-
normalized = {
|
82
|
-
'properties': props,
|
83
|
-
'elementHeader': element.get('elementHeader', {}),
|
84
|
-
}
|
85
|
-
# Prime columns with direct properties
|
86
|
-
col_data = populate_columns_from_properties(normalized, columns_struct)
|
87
|
-
columns_list = col_data.get('formats', {}).get('columns', [])
|
88
|
-
|
89
|
-
# Header-derived values (GUID, type_name, etc.)
|
90
|
-
header_props = _extract_referenceable_properties(element)
|
91
|
-
guid = header_props.get('GUID')
|
92
|
-
for column in columns_list:
|
93
|
-
key = column.get('key')
|
94
|
-
if key in header_props:
|
95
|
-
column['value'] = header_props.get(key)
|
96
|
-
elif isinstance(key, str) and key.lower() == 'guid':
|
97
|
-
column['value'] = guid
|
98
|
-
|
99
|
-
# Derived category fields if requested
|
100
|
-
if guid:
|
101
|
-
categories = None
|
102
|
-
try:
|
103
|
-
categories = self.get_categories_for_glossary(guid)
|
104
|
-
except Exception:
|
105
|
-
categories = None
|
106
|
-
cat_display_list = []
|
107
|
-
cat_qn_list = []
|
108
|
-
if isinstance(categories, list):
|
109
|
-
for category in categories:
|
110
|
-
gcp = category.get('glossaryCategoryProperties', {})
|
111
|
-
dn = gcp.get('displayName', '') or ''
|
112
|
-
qn = gcp.get('qualifiedName', '') or ''
|
113
|
-
if dn:
|
114
|
-
cat_display_list.append(dn)
|
115
|
-
if qn:
|
116
|
-
cat_qn_list.append(qn)
|
117
|
-
cat_names_md = (", \n".join(cat_display_list)).rstrip(',') if cat_display_list else ''
|
118
|
-
cat_qn_md = (", \n".join(cat_qn_list)).rstrip(',') if cat_qn_list else ''
|
119
|
-
for column in columns_list:
|
120
|
-
if column.get('key') == 'categories_names' and not column.get('value'):
|
121
|
-
column['value'] = cat_names_md
|
122
|
-
if column.get('key') == 'categories_qualified_names' and not column.get('value'):
|
123
|
-
column['value'] = cat_qn_md
|
124
|
-
|
125
|
-
# Mermaid graph if requested
|
126
|
-
for column in columns_list:
|
127
|
-
if column.get('key') == 'mermaid' and not column.get('value'):
|
128
|
-
column['value'] = element.get('mermaidGraph', '') or ''
|
129
|
-
break
|
130
|
-
|
131
|
-
return col_data
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
def _extract_term_properties(self, element: dict, columns_struct: dict) -> dict:
|
136
|
-
"""
|
137
|
-
Extract and populate term properties into columns_struct following the unified output_formatter pattern.
|
138
|
-
|
139
|
-
Args:
|
140
|
-
element (dict): The term element returned by the OMVS (contains 'glossaryTermProperties' in properties or
|
141
|
-
normalized 'properties').
|
142
|
-
columns_struct (dict): The columns structure to populate (as returned by select_output_format_set).
|
143
|
-
|
144
|
-
Returns:
|
145
|
-
dict: columns_struct with populated 'value' fields for requested columns.
|
146
|
-
"""
|
147
|
-
# First, populate from element.properties using the utility
|
148
|
-
col_data = populate_columns_from_properties(element, columns_struct)
|
149
|
-
|
150
|
-
columns_list = col_data.get("formats", {}).get("columns", [])
|
151
|
-
|
152
|
-
# Populate header-derived values
|
153
|
-
header_props = _extract_referenceable_properties(element)
|
154
|
-
for column in columns_list:
|
155
|
-
key = column.get('key')
|
156
|
-
if key in header_props:
|
157
|
-
column['value'] = header_props.get(key)
|
158
|
-
elif isinstance(key, str) and key.lower() == 'guid':
|
159
|
-
column['value'] = header_props.get('GUID')
|
160
|
-
|
161
|
-
# Derived/computed fields
|
162
|
-
# collectionCategories are classifications
|
163
|
-
classification_names = ""
|
164
|
-
classifications = element.get('elementHeader', {}).get("collectionCategories", [])
|
165
|
-
for classification in classifications:
|
166
|
-
classification_names += f"{classification['classificationName']}, "
|
167
|
-
if classification_names:
|
168
|
-
for column in columns_list:
|
169
|
-
if column.get('key') == 'classifications':
|
170
|
-
column['value'] = classification_names[:-2]
|
171
|
-
break
|
172
|
-
|
173
|
-
# Populate requested relationship-based columns generically from top-level keys
|
174
|
-
col_data = get_required_relationships(element, col_data)
|
175
|
-
|
176
|
-
# Subject area classification
|
177
|
-
subject_area = element.get('elementHeader', {}).get("subjectArea", "") or ""
|
178
|
-
subj_val = ""
|
179
|
-
if isinstance(subject_area, dict):
|
180
|
-
subj_val = subject_area.get("classificationProperties", {}).get("subjectAreaName", "")
|
181
|
-
for column in columns_list:
|
182
|
-
if column.get('key') == 'subject_area':
|
183
|
-
column['value'] = subj_val
|
184
|
-
break
|
185
|
-
|
186
|
-
# Mermaid graph
|
187
|
-
mermaid_val = element.get('mermaidGraph', "") or ""
|
188
|
-
for column in columns_list:
|
189
|
-
if column.get('key') == 'mermaid':
|
190
|
-
column['value'] = mermaid_val
|
191
|
-
break
|
192
|
-
|
193
|
-
logger.trace(f"Extracted/Populated columns: {col_data}")
|
194
|
-
|
195
|
-
return col_data
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
def _generate_glossary_output(self, elements: dict | list[dict], search_string: str,
|
200
|
-
element_type_name: str | None,
|
201
|
-
output_format: str = 'DICT',
|
202
|
-
output_format_set: dict | str = None) -> str | list[dict]:
|
203
|
-
"""Generate output for glossaries using the unified output formatter.
|
204
|
-
|
205
|
-
Args:
|
206
|
-
elements: Dictionary or list of glossary elements
|
207
|
-
search_string: The search string used
|
208
|
-
element_type_name: Optional subtype name
|
209
|
-
output_format: Desired output format
|
210
|
-
output_format_set: Optional format set name or structure
|
211
|
-
"""
|
212
|
-
entity_type = 'Glossary'
|
213
|
-
# Resolve output formats
|
214
|
-
if output_format_set:
|
215
|
-
if isinstance(output_format_set, str):
|
216
|
-
output_formats = select_output_format_set(output_format_set, output_format)
|
217
|
-
elif isinstance(output_format_set, dict):
|
218
|
-
output_formats = get_output_format_type_match(output_format_set, output_format)
|
219
|
-
else:
|
220
|
-
output_formats = None
|
221
|
-
else:
|
222
|
-
output_formats = select_output_format_set(entity_type, output_format)
|
223
|
-
if output_formats is None:
|
224
|
-
output_formats = select_output_format_set('Default', output_format)
|
225
|
-
|
226
|
-
logger.trace(f"Executing generate_glossary_output: {output_formats}")
|
227
|
-
return generate_output(
|
228
|
-
elements=elements,
|
229
|
-
search_string=search_string,
|
230
|
-
entity_type=entity_type,
|
231
|
-
output_format=output_format,
|
232
|
-
extract_properties_func=self._extract_glossary_properties,
|
233
|
-
get_additional_props_func=None,
|
234
|
-
columns_struct=output_formats,
|
235
|
-
)
|
236
|
-
|
237
|
-
def _get_term_additional_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
|
238
|
-
"""Safely compute additional properties for terms (glossary and categories) if available."""
|
239
|
-
additional: dict = {}
|
240
|
-
# Best effort: attempt to derive glossary name and categories if helper methods exist in this class
|
241
|
-
try:
|
242
|
-
# Extract glossary classification anchor if present
|
243
|
-
classifications = element.get('elementHeader', {}).get('otherClassifications', [])
|
244
|
-
glossary_name = ''
|
245
|
-
if classifications:
|
246
|
-
cls_props = classifications[0].get('classificationProperties', {}) or {}
|
247
|
-
g_guid = cls_props.get('anchorScopeGUID')
|
248
|
-
if g_guid and hasattr(self, 'get_glossary_by_guid'):
|
249
|
-
try:
|
250
|
-
gl = self.get_glossary_by_guid(g_guid)
|
251
|
-
if isinstance(gl, dict):
|
252
|
-
if output_format == 'REPORT':
|
253
|
-
glossary_name = gl.get('glossaryProperties', {}).get('displayName', '')
|
254
|
-
else:
|
255
|
-
glossary_name = gl.get('glossaryProperties', {}).get('qualifiedName', '')
|
256
|
-
except Exception:
|
257
|
-
pass
|
258
|
-
if glossary_name:
|
259
|
-
additional['in_glossary'] = glossary_name
|
260
|
-
except Exception:
|
261
|
-
pass
|
262
|
-
try:
|
263
|
-
if hasattr(self, 'get_categories_for_term') and term_guid:
|
264
|
-
cats = self.get_categories_for_term(term_guid)
|
265
|
-
names = []
|
266
|
-
if isinstance(cats, list):
|
267
|
-
for c in cats:
|
268
|
-
gcp = c.get('glossaryCategoryProperties', {})
|
269
|
-
val = gcp.get('displayName') if output_format in ['REPORT', 'LIST'] else gcp.get('qualifiedName')
|
270
|
-
if val:
|
271
|
-
names.append(val)
|
272
|
-
if names:
|
273
|
-
additional['categories'] = ", \n".join(names)
|
274
|
-
except Exception:
|
275
|
-
pass
|
276
|
-
return additional
|
277
|
-
|
278
|
-
def _generate_term_output(self, elements: dict | list[dict], search_string: str,
|
279
|
-
element_type_name: str | None,
|
280
|
-
output_format: str = 'DICT',
|
281
|
-
output_format_set: dict | str = None) -> str | list[dict]:
|
282
|
-
"""Generate output for glossary terms using the unified output formatter.
|
283
|
-
|
284
|
-
Args:
|
285
|
-
elements: Dictionary or list of term elements.
|
286
|
-
search_string: The search string used.
|
287
|
-
element_type_name: Optional subtype name; determines the entity type label when provided.
|
288
|
-
output_format: Desired output format (MD, FORM, REPORT, LIST, DICT, MERMAID, HTML).
|
289
|
-
output_format_set: Optional format set name or structure controlling columns.
|
290
|
-
|
291
|
-
Returns:
|
292
|
-
Union[str, list[dict]]: Formatted output per requested format.
|
293
|
-
"""
|
294
|
-
entity_type = 'GlossaryTerm'
|
295
|
-
# Resolve output formats
|
296
|
-
if output_format_set:
|
297
|
-
if isinstance(output_format_set, str):
|
298
|
-
output_formats = select_output_format_set(output_format_set, output_format)
|
299
|
-
elif isinstance(output_format_set, dict):
|
300
|
-
output_formats = get_output_format_type_match(output_format_set, output_format)
|
301
|
-
else:
|
302
|
-
output_formats = None
|
303
|
-
else:
|
304
|
-
output_formats = select_output_format_set(entity_type, output_format)
|
305
|
-
if output_formats is None:
|
306
|
-
output_formats = select_output_format_set('Default', output_format)
|
307
|
-
|
308
|
-
logger.trace(f"Executing generate_term_output: {output_formats}")
|
309
|
-
return generate_output(
|
310
|
-
elements=elements,
|
311
|
-
search_string=search_string,
|
312
|
-
entity_type=entity_type,
|
313
|
-
output_format=output_format,
|
314
|
-
extract_properties_func=self._extract_term_properties,
|
315
|
-
get_additional_props_func=self._get_term_additional_properties,
|
316
|
-
columns_struct=output_formats,
|
317
|
-
)
|
318
|
-
|
319
|
-
#
|
320
|
-
# Get Valid Values for Enumerations
|
321
|
-
#
|
322
|
-
|
323
|
-
async def _async_get_glossary_term_statuses(self) -> [str]:
|
324
|
-
"""Return the list of glossary term status enum values. Async version.
|
325
|
-
|
326
|
-
Parameters
|
327
|
-
----------
|
328
|
-
|
329
|
-
|
330
|
-
Returns
|
331
|
-
-------
|
332
|
-
List[str]
|
333
|
-
A list of glossary term statuses retrieved from the server.
|
334
|
-
|
335
|
-
"""
|
336
|
-
|
337
|
-
url = (f"{self.platform_url}/servers/{self.view_server}"
|
338
|
-
f"/api/open-metadata/glossary-browser/glossaries/terms/status-list")
|
339
|
-
|
340
|
-
response = await self._async_make_request("GET", url)
|
341
|
-
return response.json().get("statuses", [])
|
342
|
-
|
343
|
-
def get_glossary_term_statuses(self) -> [str]:
|
344
|
-
"""Return the list of glossary term status enum values.
|
345
|
-
|
346
|
-
Parameters
|
347
|
-
----------
|
348
|
-
|
349
|
-
|
350
|
-
Returns
|
351
|
-
-------
|
352
|
-
list of str
|
353
|
-
A list of glossary term statuses. Each status is represented as a string.
|
354
|
-
|
355
|
-
"""
|
356
|
-
loop = asyncio.get_event_loop()
|
357
|
-
response = loop.run_until_complete(self._async_get_glossary_term_statuses())
|
358
|
-
return response
|
359
|
-
|
360
|
-
async def _async_get_glossary_term_rel_statuses(self) -> [str]:
|
361
|
-
"""Return the list of glossary term relationship status enum values. These values are stored in a
|
362
|
-
term-to-term, or term-to-category, relationship and are used to indicate how much the relationship should be
|
363
|
-
trusted. Async version.
|
364
|
-
|
365
|
-
Parameters
|
366
|
-
----------
|
367
|
-
|
368
|
-
|
369
|
-
Returns
|
370
|
-
-------
|
371
|
-
List[str]
|
372
|
-
A list of glossary term statuses retrieved from the server.
|
373
|
-
|
374
|
-
"""
|
375
|
-
|
376
|
-
url = (f"{self.platform_url}/servers/{self.view_server}"
|
377
|
-
f"/api/open-metadata/glossary-browser/glossaries/terms/relationships/status-list")
|
378
|
-
|
379
|
-
response = await self._async_make_request("GET", url)
|
380
|
-
return response.json().get("statuses", [])
|
381
|
-
|
382
|
-
def get_glossary_term_rel_statuses(self) -> [str]:
|
383
|
-
"""Return the list of glossary term relationship status enum values. These values are stored in a
|
384
|
-
term-to-term, or term-to-category, relationship and are used to indicate how much the relationship should be
|
385
|
-
trusted.
|
386
|
-
|
387
|
-
Parameters
|
388
|
-
----------
|
389
|
-
|
390
|
-
|
391
|
-
Returns
|
392
|
-
-------
|
393
|
-
list of str
|
394
|
-
A list of glossary term statuses. Each status is represented as a string.
|
395
|
-
|
396
|
-
"""
|
397
|
-
loop = asyncio.get_event_loop()
|
398
|
-
response = loop.run_until_complete(self._async_get_glossary_term_rel_statuses())
|
399
|
-
return response
|
400
|
-
|
401
|
-
async def _async_get_glossary_term_activity_types(self) -> [str]:
|
402
|
-
"""Return the list of glossary term activity type enum values. Async version.
|
403
|
-
|
404
|
-
Parameters
|
405
|
-
----------
|
406
|
-
|
407
|
-
|
408
|
-
Returns
|
409
|
-
-------
|
410
|
-
List[str]
|
411
|
-
A list of glossary term statuses retrieved from the server.
|
412
|
-
|
413
|
-
"""
|
414
|
-
|
415
|
-
url = (f"{self.platform_url}/servers/{self.view_server}"
|
416
|
-
f"/api/open-metadata/glossary-browser/glossaries/terms/activity-types")
|
417
|
-
|
418
|
-
response = await self._async_make_request("GET", url)
|
419
|
-
return response.json().get("types", [])
|
420
|
-
|
421
|
-
def get_glossary_term_activity_types(self) -> [str]:
|
422
|
-
"""Return the list of glossary term activity type enum values.
|
423
|
-
|
424
|
-
Parameters
|
425
|
-
----------
|
426
|
-
|
427
|
-
|
428
|
-
Returns
|
429
|
-
-------
|
430
|
-
list of str
|
431
|
-
A list of glossary term statuses. Each status is represented as a string.
|
432
|
-
|
433
|
-
"""
|
434
|
-
loop = asyncio.get_event_loop()
|
435
|
-
response = loop.run_until_complete(self._async_get_glossary_term_statuses())
|
436
|
-
return response
|
437
|
-
|
438
|
-
async def _async_get_term_relationship_types(self) -> [str]:
|
439
|
-
"""Return the list of term relationship types enum values. Async version.
|
440
|
-
|
441
|
-
Parameters
|
442
|
-
----------
|
443
|
-
|
444
|
-
|
445
|
-
Returns
|
446
|
-
-------
|
447
|
-
List[str]
|
448
|
-
A list of glossary term relationships retrieved from the server.
|
449
|
-
|
450
|
-
"""
|
451
|
-
|
452
|
-
url = (f"{self.platform_url}/servers/{self.view_server}"
|
453
|
-
f"/api/open-metadata/glossary-manager/glossaries/terms/relationships/type-names")
|
454
|
-
|
455
|
-
response = await self._async_make_request("GET", url)
|
456
|
-
return response.json().get("names", [])
|
457
|
-
|
458
|
-
def get_term_relationship_types(self) -> [str]:
|
459
|
-
"""Return the list of term relationship type enum values.
|
460
|
-
|
461
|
-
Parameters
|
462
|
-
----------
|
463
|
-
|
464
|
-
|
465
|
-
Returns
|
466
|
-
-------
|
467
|
-
list of str
|
468
|
-
A list of term relationship types. Each status is represented as a string.
|
469
|
-
|
470
|
-
"""
|
471
|
-
loop = asyncio.get_event_loop()
|
472
|
-
response = loop.run_until_complete(self._async_get_term_relationship_types())
|
473
|
-
return response
|
474
|
-
|
475
|
-
|
476
|
-
#
|
477
|
-
# Glossaries
|
478
|
-
#
|
479
|
-
|
480
|
-
async def _async_find_glossaries(self, search_string: str, starts_with: bool = False,
|
481
|
-
ends_with: bool = False, ignore_case: bool = False, type_name: str = "Glossary",
|
482
|
-
classification_names: list[str] = None, start_from: int = 0,
|
483
|
-
page_size: int = 0, output_format: str = 'JSON',
|
484
|
-
output_format_set: str | dict = None, body: dict = None) -> list | str:
|
485
|
-
"""Retrieve the list of glossary metadata elements that contain the search string. Async version.
|
486
|
-
The search string is located in the request body and is interpreted as a plain string.
|
487
|
-
The request parameters, startsWith, endsWith, and ignoreCase can be used to allow a fuzzy search.
|
488
|
-
|
489
|
-
Parameters
|
490
|
-
----------
|
491
|
-
search_string: str,
|
492
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
493
|
-
starts_with : bool, [default=False], optional
|
494
|
-
Starts with the supplied string.
|
495
|
-
ends_with : bool, [default=False], optional
|
496
|
-
Ends with the supplied string
|
497
|
-
ignore_case : bool, [default=False], optional
|
498
|
-
Ignore case when searching
|
499
|
-
classification_names: list[str], [default=None], optional
|
500
|
-
An optional parameter indicating the classification names to filter by.
|
501
|
-
type_name: str, [default=None], optional
|
502
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
503
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
504
|
-
start_from: int, [default=0], optional
|
505
|
-
When multiple pages of results are available, the page number to start from.
|
506
|
-
page_size: int, [default=None]
|
507
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
508
|
-
the class instance.
|
509
|
-
output_format: str, default = 'JSON'
|
510
|
-
Type of output to produce:
|
511
|
-
JSON - output standard json
|
512
|
-
MD - output standard markdown with no preamble
|
513
|
-
FORM - output markdown with a preamble for a form
|
514
|
-
REPORT - output markdown with a preamble for a report
|
515
|
-
output_format_set: str | dict, optional
|
516
|
-
Output format set name or dictionary. Defaults to None.
|
517
|
-
body: dict, optional
|
518
|
-
A dictionary containing the search string and other optional parameters. If specified, these values
|
519
|
-
will override the search_string, starts_with, ends_with, and ignore_case parameters.
|
520
|
-
|
521
|
-
Returns
|
522
|
-
-------
|
523
|
-
List | str
|
524
|
-
|
525
|
-
A list of glossary definitions active in the server.
|
526
|
-
|
527
|
-
Raises
|
528
|
-
------
|
529
|
-
|
530
|
-
InvalidParameterException
|
531
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
532
|
-
PropertyServerException
|
533
|
-
Raised by the server when an issue arises in processing a valid request
|
534
|
-
NotAuthorizedException
|
535
|
-
The principle specified by the user_id does not have authorization for the requested action
|
536
|
-
|
537
|
-
"""
|
538
|
-
|
539
|
-
if search_string == "*":
|
540
|
-
search_string = None
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
545
|
-
f"by-search-string")
|
546
|
-
response = await self._async_find_request(url, _type= type_name,
|
547
|
-
_gen_output=self._generate_glossary_output,
|
548
|
-
search_string = search_string, classification_names = classification_names,
|
549
|
-
metadata_element_types = ["Glossary"],
|
550
|
-
starts_with = starts_with, ends_with = ends_with, ignore_case = ignore_case,
|
551
|
-
start_from = start_from, page_size = page_size,
|
552
|
-
output_format=output_format, output_format_set=output_format_set,
|
553
|
-
body=body)
|
554
|
-
return response
|
555
|
-
|
556
|
-
|
557
|
-
def find_glossaries(self, search_string: str, starts_with: bool = False,
|
558
|
-
ends_with: bool = False, ignore_case: bool = False, type_name: str = None,
|
559
|
-
classification_names: list[str] = None, start_from: int = 0,
|
560
|
-
page_size: int = 0, output_format: str = 'JSON',
|
561
|
-
output_format_set: str | dict = None, body: dict = None) -> list | str:
|
562
|
-
|
563
|
-
""" Retrieve the list of glossary metadata elements that contain the search string.
|
564
|
-
The search string is located in the request body and is interpreted as a plain string.
|
565
|
-
The request parameters, startsWith, endsWith, and ignoreCase can be used to allow a fuzzy search.
|
566
|
-
|
567
|
-
Parameters
|
568
|
-
----------
|
569
|
-
search_string: str,
|
570
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
571
|
-
starts_with : bool, [default=False], optional
|
572
|
-
Starts with the supplied string.
|
573
|
-
ends_with : bool, [default=False], optional
|
574
|
-
Ends with the supplied string
|
575
|
-
ignore_case : bool, [default=False], optional
|
576
|
-
Ignore case when searching
|
577
|
-
classification_names: list[str], [default=None], optional
|
578
|
-
An optional parameter indicating the classification names to filter by.
|
579
|
-
type_name: str, [default=None], optional
|
580
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
581
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
582
|
-
start_from: int, [default=0], optional
|
583
|
-
When multiple pages of results are available, the page number to start from.
|
584
|
-
page_size: int, [default=None]
|
585
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
586
|
-
the class instance.
|
587
|
-
output_format: str, default = 'JSON'
|
588
|
-
Type of output to produce:
|
589
|
-
JSON - output standard json
|
590
|
-
MD - output standard markdown with no preamble
|
591
|
-
FORM - output markdown with a preamble for a form
|
592
|
-
REPORT - output markdown with a preamble for a report
|
593
|
-
output_format_set: str | dict, optional
|
594
|
-
Output format set name or dictionary. Defaults to None.
|
595
|
-
body: dict, optional
|
596
|
-
A dictionary containing the search string and other optional parameters. If specified, these values
|
597
|
-
will override the search_string, starts_with, ends_with, and ignore_case parameters.
|
598
|
-
|
599
|
-
Returns
|
600
|
-
-------
|
601
|
-
List | str
|
602
|
-
|
603
|
-
A list of glossary definitions active in the server.
|
604
|
-
|
605
|
-
Raises
|
606
|
-
------
|
607
|
-
|
608
|
-
InvalidParameterException
|
609
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
610
|
-
PropertyServerException
|
611
|
-
Raised by the server when an issue arises in processing a valid request
|
612
|
-
NotAuthorizedException
|
613
|
-
The principle specified by the user_id does not have authorization for the requested action
|
614
|
-
|
615
|
-
"""
|
616
|
-
loop = asyncio.get_event_loop()
|
617
|
-
response = loop.run_until_complete(
|
618
|
-
self._async_find_glossaries(search_string, starts_with, ends_with, ignore_case,
|
619
|
-
type_name, classification_names, start_from, page_size,
|
620
|
-
output_format, output_format_set, body))
|
621
|
-
|
622
|
-
return response
|
623
|
-
async def _async_get_glossaries_by_name(self, filter_string: str = None, classification_names: list[str] = None,
|
624
|
-
body: dict | FilterRequestBody = None,
|
625
|
-
start_from: int = 0, page_size: int = 0,
|
626
|
-
output_format: str = 'JSON',
|
627
|
-
output_format_set: str | dict = None) -> dict | str:
|
628
|
-
"""Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
629
|
-
There are no wildcards supported on this request.
|
630
|
-
|
631
|
-
Parameters
|
632
|
-
----------
|
633
|
-
glossary_name: str,
|
634
|
-
Name of the glossary to be retrieved
|
635
|
-
effective_time: datetime, [default=None], optional
|
636
|
-
Effective time of the query. If not specified will default to any effective time. Time format is
|
637
|
-
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
638
|
-
|
639
|
-
If not provided, the server name associated with the instance is used.
|
640
|
-
start_from: int, [default=0], optional
|
641
|
-
When multiple pages of results are available, the page number to start from.
|
642
|
-
page_size: int, [default=None]
|
643
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
644
|
-
the class instance.
|
645
|
-
|
646
|
-
Returns
|
647
|
-
-------
|
648
|
-
None
|
649
|
-
|
650
|
-
Raises
|
651
|
-
------
|
652
|
-
|
653
|
-
InvalidParameterException
|
654
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
655
|
-
PropertyServerException
|
656
|
-
Raised by the server when an issue arises in processing a valid request
|
657
|
-
NotAuthorizedException
|
658
|
-
The principle specified by the user_id does not have authorization for the requested action
|
659
|
-
ConfigurationErrorException
|
660
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
661
|
-
invalid or make the new call invalid.
|
662
|
-
"""
|
663
|
-
|
664
|
-
|
665
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
666
|
-
f"by-name")
|
667
|
-
response = await self._async_get_name_request(url, _type="Glossary",
|
668
|
-
_gen_output=self._generate_glossary_output,
|
669
|
-
filter_string=filter_string,
|
670
|
-
classification_names=classification_names,
|
671
|
-
start_from=start_from, page_size=page_size,
|
672
|
-
output_format=output_format, output_format_set=output_format_set,
|
673
|
-
body=body)
|
674
|
-
|
675
|
-
return response
|
676
|
-
|
677
|
-
def get_glossaries_by_name(self, filter_string: str = None, classification_names: list[str] = None,
|
678
|
-
body: dict | FilterRequestBody = None,
|
679
|
-
start_from: int = 0, page_size: int = 0,
|
680
|
-
output_format: str = 'JSON',
|
681
|
-
output_format_set: str | dict = None) -> dict | str:
|
682
|
-
"""Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
683
|
-
There are no wildcards supported on this request.
|
684
|
-
|
685
|
-
Parameters
|
686
|
-
----------
|
687
|
-
glossary_name: str,
|
688
|
-
Name of the glossary to be retrieved
|
689
|
-
effective_time: datetime, [default=None], optional
|
690
|
-
Effective time of the query. If not specified will default to any effective time.
|
691
|
-
|
692
|
-
If not provided, the server name associated with the instance is used.
|
693
|
-
start_from: int, [default=0], optional
|
694
|
-
When multiple pages of results are available, the page number to start from.
|
695
|
-
page_size: int, [default=None]
|
696
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
697
|
-
the class instance.
|
698
|
-
|
699
|
-
Returns
|
700
|
-
-------
|
701
|
-
None
|
702
|
-
|
703
|
-
Raises
|
704
|
-
------
|
705
|
-
InvalidParameterException
|
706
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
707
|
-
PropertyServerException
|
708
|
-
Raised by the server when an issue arises in processing a valid request
|
709
|
-
NotAuthorizedException
|
710
|
-
The principle specified by the user_id does not have authorization for the requested action
|
711
|
-
ConfigurationErrorException
|
712
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
713
|
-
invalid or make the new call invalid.
|
714
|
-
"""
|
715
|
-
loop = asyncio.get_event_loop()
|
716
|
-
response = loop.run_until_complete(
|
717
|
-
self._async_get_glossaries_by_name(filter_string, classification_names, body,start_from, page_size,
|
718
|
-
output_format, output_format_set))
|
719
|
-
return response
|
720
|
-
|
721
|
-
|
722
|
-
async def _async_get_glossary_by_guid(self, glossary_guid: str, element_type: str = "Glossary", body: dict | GetRequestBody = None,
|
723
|
-
output_format: str = "JSON", output_format_set: str | dict = None) -> dict | str:
|
724
|
-
"""Retrieves information about a glossary
|
725
|
-
Parameters
|
726
|
-
----------
|
727
|
-
glossary_guid : str
|
728
|
-
Unique idetifier for the glossary
|
729
|
-
effective_time: str, optional
|
730
|
-
Effective time of the query. If not specified will default to any time. Time format is
|
731
|
-
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
732
|
-
output_format: str, default = 'JSON'
|
733
|
-
Type of output to produce:
|
734
|
-
JSON - output standard json
|
735
|
-
MD - output standard markdown with no preamble
|
736
|
-
FORM - output markdown with a preamble for a form
|
737
|
-
REPORT - output markdown with a preamble for a report
|
738
|
-
LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description,
|
739
|
-
Usage
|
740
|
-
DICT - output a dictionary structure containing all attributes
|
741
|
-
output_format_set: str | dict, optional
|
742
|
-
Output format set name or dictionary. Defaults to None.
|
743
|
-
|
744
|
-
Returns
|
745
|
-
-------
|
746
|
-
dict | str
|
747
|
-
if output format is JSON: The glossary definition associated with the glossary_guid
|
748
|
-
if output format is MD: A markdown string with the same information.
|
749
|
-
Raises
|
750
|
-
------
|
751
|
-
InvalidParameterException
|
752
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
753
|
-
PropertyServerException
|
754
|
-
Raised by the server when an issue arises in processing a valid request.
|
755
|
-
NotAuthorizedException
|
756
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
757
|
-
Notes
|
758
|
-
-----
|
759
|
-
"""
|
760
|
-
|
761
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
762
|
-
f"{glossary_guid}/retrieve")
|
763
|
-
response = await self._async_get_guid_request(url, _type=element_type,
|
764
|
-
_gen_output=self._generate_glossary_output,
|
765
|
-
output_format=output_format, output_format_set=output_format_set,
|
766
|
-
body=body)
|
767
|
-
|
768
|
-
return response
|
769
|
-
|
770
|
-
|
771
|
-
def get_glossary_by_guid(self, glossary_guid: str, element_type: str = "Glossary", body: dict| GetRequestBody=None,
|
772
|
-
output_format: str = "JSON", output_format_set: str | dict = None) -> dict:
|
773
|
-
"""Retrieves information about a glossary
|
774
|
-
Parameters
|
775
|
-
----------
|
776
|
-
glossary_guid : str
|
777
|
-
Unique idetifier for the glossary
|
778
|
-
effective_time: str, optional
|
779
|
-
Effective time of the query. If not specified will default to any time. Time format is
|
780
|
-
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
781
|
-
output_format: str, default = 'JSON'
|
782
|
-
Type of output to produce:
|
783
|
-
JSON - output standard json
|
784
|
-
MD - output standard markdown with no preamble
|
785
|
-
FORM - output markdown with a preamble for a form
|
786
|
-
REPORT - output markdown with a preamble for a report
|
787
|
-
LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description,
|
788
|
-
Usage
|
789
|
-
DICT - output a dictionary structure containing all attributes
|
790
|
-
output_format_set: str | dict, optional
|
791
|
-
Output format set name or dictionary. Defaults to None.
|
792
|
-
|
793
|
-
Returns
|
794
|
-
-------
|
795
|
-
dict
|
796
|
-
The glossary definition associated with the glossary_guid
|
797
|
-
|
798
|
-
Raises
|
799
|
-
------
|
800
|
-
InvalidParameterException
|
801
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
802
|
-
PropertyServerException
|
803
|
-
Raised by the server when an issue arises in processing a valid request.
|
804
|
-
NotAuthorizedException
|
805
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
806
|
-
Notes
|
807
|
-
-----
|
808
|
-
"""
|
809
|
-
loop = asyncio.get_event_loop()
|
810
|
-
response = loop.run_until_complete(
|
811
|
-
self._async_get_glossary_by_guid(glossary_guid, element_type, body,output_format, output_format_set))
|
812
|
-
return response
|
813
|
-
|
814
|
-
async def _async_get_glossary_for_term(self, term_guid: str, element_type: str = "GlossaryTerm",
|
815
|
-
body: dict | GetRequestBody = None,
|
816
|
-
output_format: str = "JSON",
|
817
|
-
output_format_set: str | dict = None) -> dict | str:
|
818
|
-
"""Retrieve the glossary metadata element for the requested term. The optional request body allows you to
|
819
|
-
specify that the glossary element should only be returned if it was effective at a particular time.
|
820
|
-
|
821
|
-
Async Version.
|
822
|
-
|
823
|
-
Parameters
|
824
|
-
----------
|
825
|
-
term_guid : str
|
826
|
-
The unique identifier for the term.
|
827
|
-
|
828
|
-
effective_time : datetime, optional
|
829
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
830
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
831
|
-
|
832
|
-
Returns
|
833
|
-
-------
|
834
|
-
dict
|
835
|
-
The glossary information retrieved for the specified term.
|
836
|
-
Raises
|
837
|
-
------
|
838
|
-
InvalidParameterException
|
839
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
840
|
-
PropertyServerException
|
841
|
-
Raised by the server when an issue arises in processing a valid request.
|
842
|
-
NotAuthorizedException
|
843
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
844
|
-
Notes
|
845
|
-
-----
|
846
|
-
"""
|
847
|
-
|
848
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
849
|
-
f"for-term/{term_guid}/retrieve")
|
850
|
-
|
851
|
-
response = await self._async_get_guid_request(url, _type=element_type,
|
852
|
-
_gen_output=self._generate_glossary_output,
|
853
|
-
output_format=output_format, output_format_set=output_format_set,
|
854
|
-
body=body)
|
855
|
-
return response
|
856
|
-
|
857
|
-
def get_glossary_for_term(self, term_guid: str, element_type: str = "GlossaryTerm",
|
858
|
-
body: dict | GetRequestBody = None,
|
859
|
-
output_format: str = "JSON", output_format_set: str | dict = None) -> dict | str:
|
860
|
-
"""Retrieve the glossary metadata element for the requested term. The optional request body allows you to
|
861
|
-
specify that the glossary element should only be returned if it was effective at a particular time.
|
862
|
-
|
863
|
-
Async Version.
|
864
|
-
|
865
|
-
Parameters
|
866
|
-
----------
|
867
|
-
term_guid : str
|
868
|
-
The unique identifier for the term.
|
869
|
-
|
870
|
-
effective_time : datetime, optional
|
871
|
-
TIf specified, the term information will be retrieved if it is active at the `effective_time`.
|
872
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
|
873
|
-
|
874
|
-
Returns
|
875
|
-
-------
|
876
|
-
dict
|
877
|
-
The glossary information retrieved for the specified term.
|
878
|
-
Raises
|
879
|
-
------
|
880
|
-
InvalidParameterException
|
881
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
882
|
-
PropertyServerException
|
883
|
-
Raised by the server when an issue arises in processing a valid request.
|
884
|
-
NotAuthorizedException
|
885
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
886
|
-
Notes
|
887
|
-
-----
|
888
|
-
"""
|
889
|
-
loop = asyncio.get_event_loop()
|
890
|
-
response = loop.run_until_complete(
|
891
|
-
self._async_get_glossary_for_term(term_guid, element_type, body, output_format, output_format_set))
|
892
|
-
return response
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
async def _async_get_terms_by_name(self, filter_string: str = None, classification_names: list[str] = None,
|
898
|
-
body: dict | FilterRequestBody = None,
|
899
|
-
start_from: int = 0, page_size: int = 0,
|
900
|
-
output_format: str = 'JSON',
|
901
|
-
output_format_set: str | dict = None) -> list:
|
902
|
-
"""Retrieve glossary terms by display name or qualified name. Async Version.
|
903
|
-
|
904
|
-
Parameters
|
905
|
-
----------
|
906
|
-
term : str
|
907
|
-
The term to search for in the glossaries.
|
908
|
-
glossary_guid : str, optional
|
909
|
-
The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
|
910
|
-
status_filter : list, optional
|
911
|
-
A list of status values to filter the search results. Default is an empty list, which means no filtering.
|
912
|
-
|
913
|
-
effective_time : datetime, optional
|
914
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
915
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
916
|
-
for_lineage : bool, optional
|
917
|
-
Flag to indicate whether the search should include lineage information. Default is False.
|
918
|
-
for_duplicate_processing : bool, optional
|
919
|
-
Flag to indicate whether the search should include duplicate processing information. Default is False.
|
920
|
-
start_from : int, optional
|
921
|
-
The index of the first term to retrieve. Default is 0.
|
922
|
-
page_size : int, optional
|
923
|
-
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
924
|
-
output_format: str, default = 'JSON'
|
925
|
-
Type of output to produce:
|
926
|
-
JSON - output standard json
|
927
|
-
MD - output standard markdown with no preamble
|
928
|
-
FORM - output markdown with a preamble for a form
|
929
|
-
REPORT - output markdown with a preamble for a report
|
930
|
-
DICT - output a simplified DICT structure
|
931
|
-
output_format_set: str | dict, optional
|
932
|
-
Output format set name or dictionary. Defaults to None.
|
933
|
-
|
934
|
-
Returns
|
935
|
-
-------
|
936
|
-
list
|
937
|
-
A list of terms matching the search criteria. If no terms are found, it returns the string "No terms found".
|
938
|
-
|
939
|
-
Raises
|
940
|
-
------
|
941
|
-
InvalidParameterException
|
942
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
943
|
-
PropertyServerException
|
944
|
-
Raised by the server when an issue arises in processing a valid request.
|
945
|
-
NotAuthorizedException
|
946
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
947
|
-
"""
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
952
|
-
f"terms/by-name")
|
953
|
-
|
954
|
-
response = await self._async_get_name_request(url, _type="Glossary",
|
955
|
-
_gen_output=self._generate_term_output,
|
956
|
-
filter_string=filter_string,
|
957
|
-
classification_names=classification_names,
|
958
|
-
start_from=start_from, page_size=page_size,
|
959
|
-
output_format=output_format, output_format_set=output_format_set,
|
960
|
-
body=body)
|
961
|
-
|
962
|
-
return response
|
963
|
-
|
964
|
-
|
965
|
-
def get_terms_by_name(self, filter_string: str = None, classification_names: list[str] = None,
|
966
|
-
body: dict | FilterRequestBody = None,
|
967
|
-
start_from: int = 0, page_size: int = 0,
|
968
|
-
output_format: str = 'JSON',
|
969
|
-
output_format_set: str | dict = None) -> list:
|
970
|
-
"""Retrieve glossary terms by display name or qualified name.
|
971
|
-
|
972
|
-
Parameters
|
973
|
-
----------
|
974
|
-
term : str
|
975
|
-
The term to search for in the glossaries.
|
976
|
-
glossary_guid : str, optional
|
977
|
-
The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
|
978
|
-
status_filter : list, optional
|
979
|
-
A list of status values to filter the search results. Default is an empty list, which means no filtering.
|
980
|
-
|
981
|
-
effective_time : datetime, optional
|
982
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
983
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
984
|
-
for_lineage : bool, optional
|
985
|
-
Flag to indicate whether the search should include lineage information. Default is False.
|
986
|
-
for_duplicate_processing : bool, optional
|
987
|
-
Flag to indicate whether the search should include duplicate processing information. Default is False.
|
988
|
-
start_from : int, optional
|
989
|
-
The index of the first term to retrieve. Default is 0.
|
990
|
-
page_size : int, optional
|
991
|
-
The number of terms to retrieve per page. If not provided, it will use the default page size.
|
992
|
-
output_format: str, default = 'JSON'
|
993
|
-
Type of output to produce:
|
994
|
-
JSON - output standard json
|
995
|
-
MD - output standard markdown with no preamble
|
996
|
-
FORM - output markdown with a preamble for a form
|
997
|
-
REPORT - output markdown with a preamble for a report
|
998
|
-
DICT - output a simplified DICT structure
|
999
|
-
output_format_set: str | dict, optional
|
1000
|
-
Output format set name or dictionary. Defaults to None.
|
1001
|
-
|
1002
|
-
Returns
|
1003
|
-
-------
|
1004
|
-
list
|
1005
|
-
A list of terms matching the search criteria. If no terms are found,
|
1006
|
-
it returns the string "No terms found".
|
1007
|
-
|
1008
|
-
Raises
|
1009
|
-
------
|
1010
|
-
InvalidParameterException
|
1011
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1012
|
-
PropertyServerException
|
1013
|
-
Raised by the server when an issue arises in processing a valid request.
|
1014
|
-
NotAuthorizedException
|
1015
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
1016
|
-
"""
|
1017
|
-
loop = asyncio.get_event_loop()
|
1018
|
-
response = loop.run_until_complete(
|
1019
|
-
self._async_get_terms_by_name(filter_string, classification_names, body,start_from, page_size,
|
1020
|
-
output_format, output_format_set))
|
1021
|
-
return response
|
1022
|
-
|
1023
|
-
async def _async_get_term_by_guid(self, term_guid: str, element_type: str = "GlossaryTerm", body: dict| GetRequestBody=None,
|
1024
|
-
output_format: str = "JSON", output_format_set: str | dict = None) -> dict | str:
|
1025
|
-
"""Retrieve a term using its unique id. Async version.
|
1026
|
-
Parameters
|
1027
|
-
----------
|
1028
|
-
term_guid : str
|
1029
|
-
The GUID of the glossary term to retrieve.
|
1030
|
-
output_format: str, default = 'JSON'
|
1031
|
-
Type of output to produce:
|
1032
|
-
JSON - output standard json
|
1033
|
-
MD - output standard markdown with no preamble
|
1034
|
-
FORM - output markdown with a preamble for a form
|
1035
|
-
REPORT - output markdown with a preamble for a report
|
1036
|
-
output_format_set: str | dict, optional
|
1037
|
-
Output format set name or dictionary. Defaults to None.
|
1038
|
-
|
1039
|
-
Returns
|
1040
|
-
-------
|
1041
|
-
dict | str
|
1042
|
-
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
1043
|
-
"No term found" will be returned.
|
1044
|
-
|
1045
|
-
Raises
|
1046
|
-
------
|
1047
|
-
InvalidParameterException
|
1048
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1049
|
-
PropertyServerException
|
1050
|
-
Raised by the server when an issue arises in processing a valid request.
|
1051
|
-
NotAuthorizedException
|
1052
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
1053
|
-
"""
|
1054
|
-
|
1055
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
|
1056
|
-
f"{term_guid}/retrieve")
|
1057
|
-
response = await self._async_get_guid_request(url, _type=element_type,
|
1058
|
-
_gen_output=self._generate_term_output,
|
1059
|
-
output_format=output_format, output_format_set=output_format_set,
|
1060
|
-
body=body)
|
1061
|
-
return response
|
1062
|
-
|
1063
|
-
def get_term_by_guid(self, term_guid: str, element_type: str = "GlossaryTerm", body: dict| GetRequestBody=None,
|
1064
|
-
output_format: str = "JSON", output_format_set: str | dict = None) -> dict | str:
|
1065
|
-
"""Retrieve a term using its unique id. Async version.
|
1066
|
-
Parameters
|
1067
|
-
----------
|
1068
|
-
term_guid : str
|
1069
|
-
The GUID of the glossary term to retrieve.
|
1070
|
-
output_format: str, default = 'JSON'
|
1071
|
-
Type of output to produce:
|
1072
|
-
JSON - output standard json
|
1073
|
-
MD - output standard markdown with no preamble
|
1074
|
-
FORM - output markdown with a preamble for a form
|
1075
|
-
REPORT - output markdown with a preamble for a report
|
1076
|
-
output_format_set: str | dict, optional
|
1077
|
-
Output format set name or dictionary. Defaults to None.
|
1078
|
-
Returns
|
1079
|
-
-------
|
1080
|
-
dict | str
|
1081
|
-
A dict detailing the glossary term represented by the GUID. If no term is found, the string
|
1082
|
-
"No term found" will be returned.
|
1083
|
-
Raises
|
1084
|
-
------
|
1085
|
-
InvalidParameterException
|
1086
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
1087
|
-
PropertyServerException
|
1088
|
-
Raised by the server when an issue arises in processing a valid request.
|
1089
|
-
NotAuthorizedException
|
1090
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
1091
|
-
"""
|
1092
|
-
|
1093
|
-
loop = asyncio.get_event_loop()
|
1094
|
-
response = loop.run_until_complete(self._async_get_term_by_guid(term_guid, element_type, body, output_format, output_format_set))
|
1095
|
-
|
1096
|
-
return response
|
1097
|
-
|
1098
|
-
async def _async_find_glossary_terms(self, search_string: str, starts_with: bool = False,
|
1099
|
-
ends_with: bool = False, ignore_case: bool = False, type_name: str = "GlossaryTerm",
|
1100
|
-
classification_names: list[str] = None, start_from: int = 0,
|
1101
|
-
page_size: int = 0, output_format: str = 'JSON',
|
1102
|
-
output_format_set: str | dict = None, body: dict = None) -> list | str:
|
1103
|
-
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
1104
|
-
|
1105
|
-
Parameters
|
1106
|
-
----------
|
1107
|
-
search_string: str
|
1108
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
1109
|
-
glossary_guid str
|
1110
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
1111
|
-
status_filter: list, default = [], optional
|
1112
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
1113
|
-
the results will not be filtered.
|
1114
|
-
effective_time: str, [default=None], optional
|
1115
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
1116
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1117
|
-
|
1118
|
-
If not provided, the server name associated with the instance is used.
|
1119
|
-
starts_with : bool, [default=False], optional
|
1120
|
-
Starts with the supplied string.
|
1121
|
-
ends_with : bool, [default=False], optional
|
1122
|
-
Ends with the supplied string
|
1123
|
-
ignore_case : bool, [default=False], optional
|
1124
|
-
Ignore case when searching
|
1125
|
-
for_lineage : bool, [default=False], optional
|
1126
|
-
|
1127
|
-
for_duplicate_processing : bool, [default=False], optional
|
1128
|
-
|
1129
|
-
start_from: str, [default=0], optional
|
1130
|
-
Page of results to start from
|
1131
|
-
page_size : int, optional
|
1132
|
-
Number of elements to return per page - if None, then default for class will be used.
|
1133
|
-
output_format: str, default = 'JSON'
|
1134
|
-
Type of output to produce:
|
1135
|
-
JSON - output standard json
|
1136
|
-
MD - output standard markdown with no preamble
|
1137
|
-
FORM - output markdown with a preamble for a form
|
1138
|
-
REPORT - output markdown with a preamble for a report
|
1139
|
-
|
1140
|
-
Returns
|
1141
|
-
-------
|
1142
|
-
List | str
|
1143
|
-
|
1144
|
-
A list of term definitions
|
1145
|
-
|
1146
|
-
Raises
|
1147
|
-
------
|
1148
|
-
InvalidParameterException
|
1149
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1150
|
-
PropertyServerException
|
1151
|
-
Raised by the server when an issue arises in processing a valid request
|
1152
|
-
NotAuthorizedException
|
1153
|
-
The principle specified by the user_id does not have authorization for the requested action
|
1154
|
-
|
1155
|
-
Notes
|
1156
|
-
-----
|
1157
|
-
The search string is located in the request body and is interpreted as a plain string.
|
1158
|
-
The request parameters, startsWith, endsWith, and ignoreCase can be used to allow a fuzzy search.
|
1159
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a single
|
1160
|
-
glossary.
|
1161
|
-
"""
|
1162
|
-
|
1163
|
-
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
|
1164
|
-
f"by-search-string")
|
1165
|
-
response = await self._async_find_request(url, _type= type_name,
|
1166
|
-
_gen_output=self._generate_term_output,
|
1167
|
-
search_string = search_string, classification_names = classification_names,
|
1168
|
-
metadata_element_types = ["GlossaryTerm"],
|
1169
|
-
starts_with = starts_with, ends_with = ends_with, ignore_case = ignore_case,
|
1170
|
-
start_from = start_from, page_size = page_size,
|
1171
|
-
output_format=output_format, output_format_set=output_format_set,
|
1172
|
-
body=body)
|
1173
|
-
return response
|
1174
|
-
|
1175
|
-
|
1176
|
-
def find_glossary_terms(self, search_string: str, starts_with: bool = False,
|
1177
|
-
ends_with: bool = False, ignore_case: bool = False, type_name: str = "GlossaryTerm",
|
1178
|
-
classification_names: list[str] = None, start_from: int = 0,
|
1179
|
-
page_size: int = 0, output_format: str = 'JSON',
|
1180
|
-
output_format_set: str | dict = None, body: dict = None) -> list | str:
|
1181
|
-
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
1182
|
-
|
1183
|
-
Parameters
|
1184
|
-
----------
|
1185
|
-
search_string: str
|
1186
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries
|
1187
|
-
returned.
|
1188
|
-
glossary_guid str
|
1189
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
1190
|
-
status_filter: list, default = [], optional
|
1191
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
1192
|
-
the results will not be filtered.
|
1193
|
-
effective_time: str, [default=None], optional
|
1194
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
1195
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1196
|
-
|
1197
|
-
If not provided, the server name associated with the instance is used.
|
1198
|
-
starts_with : bool, [default=False], optional
|
1199
|
-
Starts with the supplied string.
|
1200
|
-
ends_with : bool, [default=False], optional
|
1201
|
-
Ends with the supplied string
|
1202
|
-
ignore_case : bool, [default=False], optional
|
1203
|
-
Ignore case when searching
|
1204
|
-
for_lineage : bool, [default=False], optional
|
1205
|
-
|
1206
|
-
for_duplicate_processing : bool, [default=False], optional
|
1207
|
-
|
1208
|
-
start_from: str, [default=0], optional
|
1209
|
-
Page of results to start from
|
1210
|
-
page_size : int, optional
|
1211
|
-
Number of elements to return per page - if None, then default for class will be used.
|
1212
|
-
output_format: str, default = 'JSON'
|
1213
|
-
Type of output to produce:
|
1214
|
-
JSON - output standard json
|
1215
|
-
MD - output standard markdown with no preamble
|
1216
|
-
FORM - output markdown with a preamble for a form
|
1217
|
-
REPORT - output markdown with a preamble for a report
|
1218
|
-
output_format_set: str | dict, optional
|
1219
|
-
Output format set name or dictionary. Defaults to None.
|
1220
|
-
|
1221
|
-
Returns
|
1222
|
-
-------
|
1223
|
-
List | str
|
1224
|
-
|
1225
|
-
A list of term definitions
|
1226
|
-
|
1227
|
-
Raises
|
1228
|
-
------
|
1229
|
-
InvalidParameterException
|
1230
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1231
|
-
PropertyServerException
|
1232
|
-
Raised by the server when an issue arises in processing a valid request
|
1233
|
-
NotAuthorizedException
|
1234
|
-
The principle specified by the user_id does not have authorization for the requested action
|
1235
|
-
|
1236
|
-
Notes
|
1237
|
-
-----
|
1238
|
-
The search string is located in the request body and is interpreted as a plain string.
|
1239
|
-
The request parameters, startsWith, endsWith, and ignoreCase can be used to allow a fuzzy search.
|
1240
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a
|
1241
|
-
single glossary.
|
1242
|
-
"""
|
1243
|
-
|
1244
|
-
loop = asyncio.get_event_loop()
|
1245
|
-
response = loop.run_until_complete(
|
1246
|
-
self._async_find_glossary_terms(search_string, starts_with,
|
1247
|
-
ends_with, ignore_case, type_name,classification_names,
|
1248
|
-
start_from,
|
1249
|
-
page_size, output_format, output_format_set, body))
|
1250
|
-
|
1251
|
-
return response
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
if __name__ == "__main__":
|
1259
|
-
print("Main-Glossary Browser")
|