pyegeria 5.2.0.6__py3-none-any.whl → 5.2.0.8__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/__init__.py +2 -0
- pyegeria/_client.py +7 -2
- pyegeria/asset_catalog_omvs.py +34 -0
- pyegeria/classification_manager_omvs.py +2 -3
- pyegeria/collection_manager_omvs.py +83 -39
- pyegeria/commands/cat/get_collection.py +22 -13
- pyegeria/commands/cat/list_collections.py +10 -5
- pyegeria/commands/cat/list_deployed_database_schemas.py +5 -11
- pyegeria/commands/cli/egeria.py +7 -7
- pyegeria/commands/cli/egeria_cat.py +3 -3
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.30.02@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.31.47@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.32.11@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.34.19@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.42@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.55@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.37.07@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
- pyegeria/egeria_client.py +2 -0
- pyegeria/egeria_tech_client.py +5 -0
- pyegeria/metadata_explorer_omvs.py +2085 -0
- {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.8.dist-info}/METADATA +1 -1
- {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.8.dist-info}/RECORD +31 -17
- {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.8.dist-info}/LICENSE +0 -0
- {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.8.dist-info}/WHEEL +0 -0
- {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.8.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,2085 @@
|
|
1
|
+
"""PDX-License-Identifier: Apache-2.0
|
2
|
+
Copyright Contributors to the ODPi Egeria project.
|
3
|
+
|
4
|
+
This module provides access to the metadata-explorer OMVS module.
|
5
|
+
|
6
|
+
[metadata-explorer](https://egeria-project.org/services/omvs/metadata-explorer/overview/)
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import asyncio
|
11
|
+
|
12
|
+
from httpx import Response
|
13
|
+
|
14
|
+
from pyegeria import body_slimmer
|
15
|
+
|
16
|
+
|
17
|
+
from pyegeria._client import Client, max_paging_size
|
18
|
+
from pyegeria._globals import default_time_out
|
19
|
+
|
20
|
+
|
21
|
+
def query_seperator(current_string):
|
22
|
+
if current_string == "":
|
23
|
+
return "?"
|
24
|
+
else:
|
25
|
+
return "&"
|
26
|
+
|
27
|
+
|
28
|
+
"params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to the query string"
|
29
|
+
|
30
|
+
|
31
|
+
def query_string(params):
|
32
|
+
result = ""
|
33
|
+
for i in range(len(params)):
|
34
|
+
if params[i][1] is not None:
|
35
|
+
result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
|
36
|
+
return result
|
37
|
+
|
38
|
+
|
39
|
+
def base_path(client, view_server: str):
|
40
|
+
return f"{client.platform_url}/servers/{view_server}/api/open-metadata/metadata-explorer"
|
41
|
+
|
42
|
+
|
43
|
+
class MetadataExplorer(Client):
|
44
|
+
"""MetadataExplorer is a class that extends the Client class. The Metadata Explorer OMVS provides APIs for
|
45
|
+
supporting the search, query and retrieval of open metadata. It is an advanced API for users that understands
|
46
|
+
the Open Metadata Types.
|
47
|
+
|
48
|
+
Attributes:
|
49
|
+
|
50
|
+
view_server_name: str
|
51
|
+
The name of the View Server to connect to.
|
52
|
+
platform_url : str
|
53
|
+
URL of the server platform to connect to
|
54
|
+
user_id : str
|
55
|
+
The identity of the user calling the method - this sets a
|
56
|
+
default optionally used by the methods when the user
|
57
|
+
doesn't pass the user_id on a method call.
|
58
|
+
user_pwd: str
|
59
|
+
The password associated with the user_id. Defaults to None
|
60
|
+
|
61
|
+
|
62
|
+
"""
|
63
|
+
|
64
|
+
def __init__(
|
65
|
+
self,
|
66
|
+
view_server: str,
|
67
|
+
platform_url: str,
|
68
|
+
user_id: str = None,
|
69
|
+
user_pwd: str = None,
|
70
|
+
token: str = None,
|
71
|
+
):
|
72
|
+
self.view_server = view_server
|
73
|
+
self.platform_url = platform_url
|
74
|
+
self.user_id = user_id
|
75
|
+
self.user_pwd = user_pwd
|
76
|
+
self.metadata_explorer_command_root: str = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/metadata-explorer"
|
77
|
+
Client.__init__(
|
78
|
+
self,
|
79
|
+
view_server,
|
80
|
+
platform_url,
|
81
|
+
user_id=user_id,
|
82
|
+
user_pwd=user_pwd,
|
83
|
+
token=token,
|
84
|
+
)
|
85
|
+
|
86
|
+
#
|
87
|
+
# Get
|
88
|
+
#
|
89
|
+
|
90
|
+
async def _async_get_metadata_guid_by_unique_name(
|
91
|
+
self,
|
92
|
+
name: str,
|
93
|
+
property_name: str,
|
94
|
+
effective_time: str = None,
|
95
|
+
for_lineage: bool = None,
|
96
|
+
for_duplicate_processing: bool = None,
|
97
|
+
) -> str:
|
98
|
+
"""
|
99
|
+
Retrieve the metadata element GUID using its unique name (typically the qualified name, but it is possible to
|
100
|
+
specify a different property name in the request body as long as it is unique).
|
101
|
+
If multiple matching instances are found, an exception is thrown. Async version.
|
102
|
+
|
103
|
+
Parameters
|
104
|
+
----------
|
105
|
+
name : str
|
106
|
+
- unique name to search for
|
107
|
+
property_name: str
|
108
|
+
- property name to search in (typically the qualified name)
|
109
|
+
effective_time: str, default = None
|
110
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
111
|
+
for_lineage: bool, default is set by server
|
112
|
+
- determines if elements classified as Memento should be returned - normally false
|
113
|
+
for_duplicate_processing: bool, default is set by server
|
114
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
115
|
+
|
116
|
+
Returns
|
117
|
+
-------
|
118
|
+
str
|
119
|
+
The GUID of the element - or "No element found"
|
120
|
+
|
121
|
+
Raises
|
122
|
+
------
|
123
|
+
InvalidParameterException
|
124
|
+
one of the parameters is null or invalid or
|
125
|
+
PropertyServerException
|
126
|
+
There is a problem adding the element properties to the metadata repository or
|
127
|
+
UserNotAuthorizedException
|
128
|
+
the requesting user is not authorized to issue this request.
|
129
|
+
"""
|
130
|
+
|
131
|
+
possible_query_params = query_string(
|
132
|
+
[
|
133
|
+
("forLineage", for_lineage),
|
134
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
135
|
+
]
|
136
|
+
)
|
137
|
+
|
138
|
+
body = {
|
139
|
+
"class": "NameRequestBody",
|
140
|
+
"name": name,
|
141
|
+
"namePropertyName": property_name,
|
142
|
+
"effectiveTime": effective_time,
|
143
|
+
}
|
144
|
+
|
145
|
+
url = (
|
146
|
+
f"{base_path(self, self.view_server)}/metadata-elements/guid-by-unique-name"
|
147
|
+
f"{possible_query_params}"
|
148
|
+
)
|
149
|
+
response: Response = await self._async_make_request(
|
150
|
+
"POST", url, body_slimmer(body)
|
151
|
+
)
|
152
|
+
return response.json().get("guid", "No elements found")
|
153
|
+
|
154
|
+
def get_metadata_guid_by_unique_name(
|
155
|
+
self,
|
156
|
+
name: str,
|
157
|
+
property_name: str,
|
158
|
+
effective_time: str = None,
|
159
|
+
for_lineage: bool = None,
|
160
|
+
for_duplicate_processing: bool = None,
|
161
|
+
) -> str:
|
162
|
+
"""
|
163
|
+
Retrieve the metadata element GUID using its unique name (typically the qualified name, but it is possible to
|
164
|
+
specify a different property name in the request body as long as it is unique).
|
165
|
+
If multiple matching instances are found, an exception is thrown.
|
166
|
+
|
167
|
+
Parameters
|
168
|
+
----------
|
169
|
+
name : str
|
170
|
+
- unique name to search for
|
171
|
+
property_name: str
|
172
|
+
- property name to search in (typically the qualified name)
|
173
|
+
effective_time: str, default = None
|
174
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
175
|
+
for_lineage: bool, default is set by server
|
176
|
+
- determines if elements classified as Memento should be returned - normally false
|
177
|
+
for_duplicate_processing: bool, default is set by server
|
178
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
179
|
+
|
180
|
+
Returns
|
181
|
+
-------
|
182
|
+
str
|
183
|
+
The GUID of the element - or "No element found"
|
184
|
+
|
185
|
+
Raises
|
186
|
+
------
|
187
|
+
InvalidParameterException
|
188
|
+
one of the parameters is null or invalid or
|
189
|
+
PropertyServerException
|
190
|
+
There is a problem adding the element properties to the metadata repository or
|
191
|
+
UserNotAuthorizedException
|
192
|
+
the requesting user is not authorized to issue this request.
|
193
|
+
"""
|
194
|
+
|
195
|
+
loop = asyncio.get_event_loop()
|
196
|
+
response = loop.run_until_complete(
|
197
|
+
self._async_get_metadata_guid_by_unique_name(
|
198
|
+
name,
|
199
|
+
property_name,
|
200
|
+
effective_time,
|
201
|
+
for_lineage,
|
202
|
+
for_duplicate_processing,
|
203
|
+
)
|
204
|
+
)
|
205
|
+
return response
|
206
|
+
|
207
|
+
async def _async_get_metadata_element_by_guid(
|
208
|
+
self,
|
209
|
+
guid: str,
|
210
|
+
effective_time: str = None,
|
211
|
+
for_lineage: bool = None,
|
212
|
+
for_duplicate_processing: bool = None,
|
213
|
+
) -> dict | str:
|
214
|
+
"""
|
215
|
+
Retrieve the metadata element using its unique identifier. Async version.
|
216
|
+
|
217
|
+
Parameters
|
218
|
+
----------
|
219
|
+
guid : str
|
220
|
+
- unique identifier of the element to retrieve
|
221
|
+
effective_time: str, default = None
|
222
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
223
|
+
for_lineage: bool, default is set by server
|
224
|
+
- determines if elements classified as Memento should be returned - normally false
|
225
|
+
for_duplicate_processing: bool, default is set by server
|
226
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
227
|
+
|
228
|
+
Returns
|
229
|
+
-------
|
230
|
+
dict | str
|
231
|
+
If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
|
232
|
+
|
233
|
+
Raises
|
234
|
+
------
|
235
|
+
InvalidParameterException
|
236
|
+
one of the parameters is null or invalid or
|
237
|
+
PropertyServerException
|
238
|
+
There is a problem adding the element properties to the metadata repository or
|
239
|
+
UserNotAuthorizedException
|
240
|
+
the requesting user is not authorized to issue this request.
|
241
|
+
"""
|
242
|
+
|
243
|
+
possible_query_params = query_string(
|
244
|
+
[
|
245
|
+
("forLineage", for_lineage),
|
246
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
247
|
+
]
|
248
|
+
)
|
249
|
+
|
250
|
+
body = {
|
251
|
+
"class": "EffectiveTimeRequestBody",
|
252
|
+
"effectiveTime": effective_time,
|
253
|
+
}
|
254
|
+
|
255
|
+
url = (
|
256
|
+
f"{base_path(self, self.view_server)}/metadata-elements/{guid}"
|
257
|
+
f"{possible_query_params}"
|
258
|
+
)
|
259
|
+
response: Response = await self._async_make_request(
|
260
|
+
"POST", url, body_slimmer(body)
|
261
|
+
)
|
262
|
+
return response.json().get("element", "No elements found")
|
263
|
+
|
264
|
+
def get_metadata_element_by_guid(
|
265
|
+
self,
|
266
|
+
guid: str,
|
267
|
+
effective_time: str = None,
|
268
|
+
for_lineage: bool = None,
|
269
|
+
for_duplicate_processing: bool = None,
|
270
|
+
) -> dict | str:
|
271
|
+
"""
|
272
|
+
Retrieve the metadata element using its unique identifier.
|
273
|
+
|
274
|
+
Parameters
|
275
|
+
----------
|
276
|
+
guid : str
|
277
|
+
- unique identifier of the element to retrieve
|
278
|
+
effective_time: str, default = None
|
279
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
280
|
+
for_lineage: bool, default is set by server
|
281
|
+
- determines if elements classified as Memento should be returned - normally false
|
282
|
+
for_duplicate_processing: bool, default is set by server
|
283
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
284
|
+
|
285
|
+
Returns
|
286
|
+
-------
|
287
|
+
dict | str
|
288
|
+
If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
|
289
|
+
|
290
|
+
Raises
|
291
|
+
------
|
292
|
+
InvalidParameterException
|
293
|
+
one of the parameters is null or invalid or
|
294
|
+
PropertyServerException
|
295
|
+
There is a problem adding the element properties to the metadata repository or
|
296
|
+
UserNotAuthorizedException
|
297
|
+
the requesting user is not authorized to issue this request.
|
298
|
+
"""
|
299
|
+
|
300
|
+
loop = asyncio.get_event_loop()
|
301
|
+
response = loop.run_until_complete(
|
302
|
+
self._async_get_metadata_element_by_guid(
|
303
|
+
guid, effective_time, for_lineage, for_duplicate_processing
|
304
|
+
)
|
305
|
+
)
|
306
|
+
return response
|
307
|
+
|
308
|
+
async def _async_get_metadata_element_by_unique_name(
|
309
|
+
self,
|
310
|
+
name: str,
|
311
|
+
property_name: str = "qualifiedName",
|
312
|
+
effective_time: str = None,
|
313
|
+
for_lineage: bool = None,
|
314
|
+
for_duplicate_processing: bool = None,
|
315
|
+
) -> dict | str:
|
316
|
+
"""
|
317
|
+
Retrieve the metadata element using its unique name (typically the *qualifiedName* attribute but other attributes
|
318
|
+
can be used if they are unique - such as *pathName* for a file). Async version.
|
319
|
+
|
320
|
+
Parameters
|
321
|
+
----------
|
322
|
+
name : str
|
323
|
+
- unique name to search for
|
324
|
+
property_name: str, default = "qualifiedName"
|
325
|
+
- property name to search in (typically the qualified name)
|
326
|
+
effective_time: str, default = None
|
327
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
328
|
+
for_lineage: bool, default is set by server
|
329
|
+
- determines if elements classified as Memento should be returned - normally false
|
330
|
+
for_duplicate_processing: bool, default is set by server
|
331
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
332
|
+
|
333
|
+
Returns
|
334
|
+
-------
|
335
|
+
dict | str
|
336
|
+
If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
|
337
|
+
|
338
|
+
Raises
|
339
|
+
------
|
340
|
+
InvalidParameterException
|
341
|
+
one of the parameters is null or invalid or
|
342
|
+
PropertyServerException
|
343
|
+
There is a problem adding the element properties to the metadata repository or
|
344
|
+
UserNotAuthorizedException
|
345
|
+
the requesting user is not authorized to issue this request.
|
346
|
+
"""
|
347
|
+
|
348
|
+
possible_query_params = query_string(
|
349
|
+
[
|
350
|
+
("forLineage", for_lineage),
|
351
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
352
|
+
]
|
353
|
+
)
|
354
|
+
|
355
|
+
body = {
|
356
|
+
"class": "NameRequestBody",
|
357
|
+
"name": name,
|
358
|
+
"namePropertyName": property_name,
|
359
|
+
"effectiveTime": effective_time,
|
360
|
+
}
|
361
|
+
|
362
|
+
url = (
|
363
|
+
f"{base_path(self, self.view_server)}/metadata-elements/by-unique-name"
|
364
|
+
f"{possible_query_params}"
|
365
|
+
)
|
366
|
+
response: Response = await self._async_make_request(
|
367
|
+
"POST", url, body_slimmer(body)
|
368
|
+
)
|
369
|
+
return response.json().get("element", "No elements found")
|
370
|
+
|
371
|
+
def get_metadata_element_by_unique_name(
|
372
|
+
self,
|
373
|
+
name: str,
|
374
|
+
property_name: str = "qualifiedName",
|
375
|
+
effective_time: str = None,
|
376
|
+
for_lineage: bool = False,
|
377
|
+
for_duplicate_processing: bool = False,
|
378
|
+
) -> str:
|
379
|
+
"""
|
380
|
+
Retrieve the metadata element using its unique name (typically the *qualifiedName* attribute but other attributes
|
381
|
+
can be used if they are unique - such as *pathName* for a file).
|
382
|
+
|
383
|
+
Parameters
|
384
|
+
----------
|
385
|
+
name : str
|
386
|
+
- unique name to search for
|
387
|
+
property_name: str, default = "qualifiedName"
|
388
|
+
- property name to search in (typically the qualified name)
|
389
|
+
effective_time: str, default = None
|
390
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
391
|
+
for_lineage: bool, default is set by server
|
392
|
+
- determines if elements classified as Memento should be returned - normally false
|
393
|
+
for_duplicate_processing: bool, default is set by server
|
394
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
395
|
+
|
396
|
+
Returns
|
397
|
+
-------
|
398
|
+
dict | str
|
399
|
+
If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
|
400
|
+
|
401
|
+
|
402
|
+
Raises
|
403
|
+
------
|
404
|
+
InvalidParameterException
|
405
|
+
one of the parameters is null or invalid or
|
406
|
+
PropertyServerException
|
407
|
+
There is a problem adding the element properties to the metadata repository or
|
408
|
+
UserNotAuthorizedException
|
409
|
+
the requesting user is not authorized to issue this request.
|
410
|
+
"""
|
411
|
+
|
412
|
+
loop = asyncio.get_event_loop()
|
413
|
+
response = loop.run_until_complete(
|
414
|
+
self._async_get_metadata_element_by_unique_name(
|
415
|
+
name,
|
416
|
+
property_name,
|
417
|
+
effective_time,
|
418
|
+
for_lineage,
|
419
|
+
for_duplicate_processing,
|
420
|
+
)
|
421
|
+
)
|
422
|
+
return response
|
423
|
+
|
424
|
+
async def _async_get_metadata_element_history(
|
425
|
+
self,
|
426
|
+
guid: str,
|
427
|
+
effective_time: str = None,
|
428
|
+
oldest_first: bool = False,
|
429
|
+
from_time: str = None,
|
430
|
+
to_time: str = None,
|
431
|
+
for_lineage: bool = None,
|
432
|
+
for_duplicate_processing: bool = None,
|
433
|
+
start_from: int = 0,
|
434
|
+
page_size: int = max_paging_size,
|
435
|
+
time_out: int = default_time_out,
|
436
|
+
) -> list | str:
|
437
|
+
"""
|
438
|
+
Retrieve all the versions of a metadata element. Async version.
|
439
|
+
|
440
|
+
Parameters
|
441
|
+
----------
|
442
|
+
guid: str
|
443
|
+
- Unique identity of element to retrieve.
|
444
|
+
effective_time: str, default = None
|
445
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
446
|
+
oldest_first: bool, default = False
|
447
|
+
from_time: str, default = None
|
448
|
+
Time to begin returning history
|
449
|
+
to_time: str, default = None
|
450
|
+
Time to end returning history
|
451
|
+
for_lineage: bool, default is set by server
|
452
|
+
- determines if elements classified as Memento should be returned - normally false
|
453
|
+
for_duplicate_processing: bool, default is set by server
|
454
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
455
|
+
start_from: int, default = 0
|
456
|
+
- index of the list to start from (0 for start).
|
457
|
+
page_size
|
458
|
+
- maximum number of elements to return.
|
459
|
+
time_out: int, default = default_time_out
|
460
|
+
- http request timeout for this request
|
461
|
+
|
462
|
+
Returns
|
463
|
+
-------
|
464
|
+
[dict] | str
|
465
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
466
|
+
|
467
|
+
Raises
|
468
|
+
------
|
469
|
+
InvalidParameterException
|
470
|
+
one of the parameters is null or invalid or
|
471
|
+
PropertyServerException
|
472
|
+
There is a problem adding the element properties to the metadata repository or
|
473
|
+
UserNotAuthorizedException
|
474
|
+
the requesting user is not authorized to issue this request.
|
475
|
+
"""
|
476
|
+
|
477
|
+
possible_query_params = query_string(
|
478
|
+
[
|
479
|
+
("startFrom", start_from),
|
480
|
+
("pageSize", page_size),
|
481
|
+
("oldestFirst", oldest_first),
|
482
|
+
("forLineage", for_lineage),
|
483
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
484
|
+
]
|
485
|
+
)
|
486
|
+
|
487
|
+
body = {
|
488
|
+
"class": "HistoryRequestBody",
|
489
|
+
"effectiveTime": effective_time,
|
490
|
+
"fromTime": from_time,
|
491
|
+
"toTime": to_time,
|
492
|
+
}
|
493
|
+
|
494
|
+
url = (
|
495
|
+
f"{base_path(self, self.view_server)}/metadata-elements/{guid}/history"
|
496
|
+
f"{possible_query_params}"
|
497
|
+
)
|
498
|
+
|
499
|
+
response: Response = await self._async_make_request(
|
500
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
501
|
+
)
|
502
|
+
|
503
|
+
elements = response.json().get("elementList", "No elements found")
|
504
|
+
if type(elements) is list:
|
505
|
+
if len(elements) == 0:
|
506
|
+
return "No elements found"
|
507
|
+
return elements
|
508
|
+
|
509
|
+
def get_metadata_element_history(
|
510
|
+
self,
|
511
|
+
guid: str,
|
512
|
+
effective_time: str = None,
|
513
|
+
oldest_first: bool = False,
|
514
|
+
from_time: str = None,
|
515
|
+
to_time: str = None,
|
516
|
+
for_lineage: bool = None,
|
517
|
+
for_duplicate_processing: bool = None,
|
518
|
+
start_from: int = 0,
|
519
|
+
page_size: int = max_paging_size,
|
520
|
+
time_out: int = default_time_out,
|
521
|
+
) -> list | str:
|
522
|
+
"""
|
523
|
+
Retrieve all the versions of a metadata element.
|
524
|
+
|
525
|
+
Parameters
|
526
|
+
----------
|
527
|
+
guid: str
|
528
|
+
- Unique identity of element to retrieve.
|
529
|
+
effective_time: str, default = None
|
530
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
531
|
+
oldest_first: bool, default = False
|
532
|
+
from_time: str, default = None
|
533
|
+
Time to begin returning history
|
534
|
+
to_time: str, default = None
|
535
|
+
Time to end returning history
|
536
|
+
for_lineage: bool, default is set by server
|
537
|
+
- determines if elements classified as Memento should be returned - normally false
|
538
|
+
for_duplicate_processing: bool, default is set by server
|
539
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
540
|
+
start_from: int, default = 0
|
541
|
+
- index of the list to start from (0 for start).
|
542
|
+
page_size
|
543
|
+
- maximum number of elements to return.
|
544
|
+
time_out: int, default = default_time_out
|
545
|
+
- http request timeout for this request
|
546
|
+
|
547
|
+
Returns
|
548
|
+
-------
|
549
|
+
[dict] | str
|
550
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
551
|
+
|
552
|
+
Raises
|
553
|
+
------
|
554
|
+
InvalidParameterException
|
555
|
+
one of the parameters is null or invalid or
|
556
|
+
PropertyServerException
|
557
|
+
There is a problem adding the element properties to the metadata repository or
|
558
|
+
UserNotAuthorizedException
|
559
|
+
the requesting user is not authorized to issue this request.
|
560
|
+
"""
|
561
|
+
|
562
|
+
loop = asyncio.get_event_loop()
|
563
|
+
response = loop.run_until_complete(
|
564
|
+
self._async_get_metadata_element_history(
|
565
|
+
guid,
|
566
|
+
effective_time,
|
567
|
+
oldest_first,
|
568
|
+
from_time,
|
569
|
+
to_time,
|
570
|
+
for_lineage,
|
571
|
+
for_duplicate_processing,
|
572
|
+
start_from,
|
573
|
+
page_size,
|
574
|
+
time_out,
|
575
|
+
)
|
576
|
+
)
|
577
|
+
return response
|
578
|
+
|
579
|
+
async def _async_find_metadata_elements_with_string(
|
580
|
+
self,
|
581
|
+
body: dict,
|
582
|
+
for_lineage: bool = None,
|
583
|
+
for_duplicate_processing: bool = None,
|
584
|
+
start_from: int = 0,
|
585
|
+
page_size: int = max_paging_size,
|
586
|
+
time_out: int = default_time_out,
|
587
|
+
) -> list | str:
|
588
|
+
"""
|
589
|
+
Return a list of metadata elements that match the supplied criteria. The results can be returned over many pages.
|
590
|
+
Async version.
|
591
|
+
|
592
|
+
Parameters
|
593
|
+
----------
|
594
|
+
body: dict
|
595
|
+
- A structure containing the search criteria. (example below)
|
596
|
+
for_lineage: bool, default is set by server
|
597
|
+
- determines if elements classified as Memento should be returned - normally false
|
598
|
+
for_duplicate_processing: bool, default is set by server
|
599
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
600
|
+
start_from: int, default = 0
|
601
|
+
- index of the list to start from (0 for start).
|
602
|
+
page_size
|
603
|
+
- maximum number of elements to return.
|
604
|
+
time_out: int, default = default_time_out
|
605
|
+
- http request timeout for this request
|
606
|
+
|
607
|
+
Returns
|
608
|
+
-------
|
609
|
+
[dict] | str
|
610
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
611
|
+
|
612
|
+
Raises
|
613
|
+
------
|
614
|
+
InvalidParameterException
|
615
|
+
one of the parameters is null or invalid or
|
616
|
+
PropertyServerException
|
617
|
+
There is a problem adding the element properties to the metadata repository or
|
618
|
+
UserNotAuthorizedException
|
619
|
+
the requesting user is not authorized to issue this request.
|
620
|
+
|
621
|
+
Notes:
|
622
|
+
|
623
|
+
Sample body:
|
624
|
+
{
|
625
|
+
"class" : "SearchStringRequestBody",
|
626
|
+
"searchString" : "Egeria",
|
627
|
+
"typeName" : "ValidValueDefinition",
|
628
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
629
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
630
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
631
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
632
|
+
"sequencingProperty": ""
|
633
|
+
}
|
634
|
+
|
635
|
+
"""
|
636
|
+
|
637
|
+
possible_query_params = query_string(
|
638
|
+
[
|
639
|
+
("startFrom", start_from),
|
640
|
+
("pageSize", page_size),
|
641
|
+
("forLineage", for_lineage),
|
642
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
643
|
+
]
|
644
|
+
)
|
645
|
+
|
646
|
+
url = (
|
647
|
+
f"{base_path(self, self.view_server)}/metadata-elements/by-search-string"
|
648
|
+
f"{possible_query_params}"
|
649
|
+
)
|
650
|
+
|
651
|
+
response: Response = await self._async_make_request(
|
652
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
653
|
+
)
|
654
|
+
|
655
|
+
elements = response.json().get("elementList", "No elements found")
|
656
|
+
if type(elements) is list:
|
657
|
+
if len(elements) == 0:
|
658
|
+
return "No elements found"
|
659
|
+
return elements
|
660
|
+
|
661
|
+
def find_metadata_elements_with_string(
|
662
|
+
self,
|
663
|
+
body: dict,
|
664
|
+
for_lineage: bool = None,
|
665
|
+
for_duplicate_processing: bool = None,
|
666
|
+
start_from: int = 0,
|
667
|
+
page_size: int = max_paging_size,
|
668
|
+
time_out: int = default_time_out,
|
669
|
+
) -> list | str:
|
670
|
+
"""
|
671
|
+
Return a list of metadata elements that match the supplied criteria. The results can be returned over many pages.
|
672
|
+
Async version.
|
673
|
+
|
674
|
+
Parameters
|
675
|
+
----------
|
676
|
+
body: dict
|
677
|
+
- A structure containing the search criteria. (example below)
|
678
|
+
for_lineage: bool, default is set by server
|
679
|
+
- determines if elements classified as Memento should be returned - normally false
|
680
|
+
for_duplicate_processing: bool, default is set by server
|
681
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
682
|
+
start_from: int, default = 0
|
683
|
+
- index of the list to start from (0 for start).
|
684
|
+
page_size
|
685
|
+
- maximum number of elements to return.
|
686
|
+
time_out: int, default = default_time_out
|
687
|
+
- http request timeout for this request
|
688
|
+
|
689
|
+
Returns
|
690
|
+
-------
|
691
|
+
[dict] | str
|
692
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
693
|
+
|
694
|
+
Raises
|
695
|
+
------
|
696
|
+
InvalidParameterException
|
697
|
+
one of the parameters is null or invalid or
|
698
|
+
PropertyServerException
|
699
|
+
There is a problem adding the element properties to the metadata repository or
|
700
|
+
UserNotAuthorizedException
|
701
|
+
the requesting user is not authorized to issue this request.
|
702
|
+
|
703
|
+
Notes:
|
704
|
+
|
705
|
+
Sample body:
|
706
|
+
{
|
707
|
+
"class" : "SearchStringRequestBody",
|
708
|
+
"searchString" : "Egeria",
|
709
|
+
"typeName" : "ValidValueDefinition",
|
710
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
711
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
712
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
713
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
714
|
+
"sequencingProperty": ""
|
715
|
+
}
|
716
|
+
|
717
|
+
"""
|
718
|
+
loop = asyncio.get_event_loop()
|
719
|
+
response = loop.run_until_complete(
|
720
|
+
self._async_find_metadata_elements_with_string(
|
721
|
+
body,
|
722
|
+
for_lineage,
|
723
|
+
for_duplicate_processing,
|
724
|
+
start_from,
|
725
|
+
page_size,
|
726
|
+
time_out,
|
727
|
+
)
|
728
|
+
)
|
729
|
+
return response
|
730
|
+
|
731
|
+
async def _async_get_all_related_metadata_elements(
|
732
|
+
self,
|
733
|
+
guid: str,
|
734
|
+
body: dict,
|
735
|
+
for_lineage: bool = None,
|
736
|
+
for_duplicate_processing: bool = None,
|
737
|
+
starting_at_end: int = 0,
|
738
|
+
start_from: int = 0,
|
739
|
+
page_size: int = max_paging_size,
|
740
|
+
time_out: int = default_time_out,
|
741
|
+
) -> list | str:
|
742
|
+
"""
|
743
|
+
Retrieve the metadata elements connected to the supplied element.
|
744
|
+
Async version.
|
745
|
+
|
746
|
+
Parameters
|
747
|
+
----------
|
748
|
+
guid: str
|
749
|
+
- Unique identity of element to retrieve.
|
750
|
+
body: dict
|
751
|
+
- A structure containing the search criteria. (example below)
|
752
|
+
for_lineage: bool, default is set by server
|
753
|
+
- determines if elements classified as Memento should be returned - normally false
|
754
|
+
for_duplicate_processing: bool, default is set by server
|
755
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
756
|
+
starting_at_end: int, default = 0
|
757
|
+
- Relationship end to start from.
|
758
|
+
start_from: int, default = 0
|
759
|
+
- index of the list to start from (0 for start).
|
760
|
+
page_size
|
761
|
+
- maximum number of elements to return.
|
762
|
+
time_out: int, default = default_time_out
|
763
|
+
- http request timeout for this request
|
764
|
+
|
765
|
+
Returns
|
766
|
+
-------
|
767
|
+
[dict] | str
|
768
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
769
|
+
|
770
|
+
Raises
|
771
|
+
------
|
772
|
+
InvalidParameterException
|
773
|
+
one of the parameters is null or invalid or
|
774
|
+
PropertyServerException
|
775
|
+
There is a problem adding the element properties to the metadata repository or
|
776
|
+
UserNotAuthorizedException
|
777
|
+
the requesting user is not authorized to issue this request.
|
778
|
+
|
779
|
+
Notes:
|
780
|
+
|
781
|
+
Sample body:
|
782
|
+
{
|
783
|
+
"class" : "ResultsRequestBody",
|
784
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
785
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
786
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
787
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
788
|
+
"sequencingProperty": "fileName"
|
789
|
+
}
|
790
|
+
|
791
|
+
"""
|
792
|
+
|
793
|
+
possible_query_params = query_string(
|
794
|
+
[
|
795
|
+
("startingAtEnd", starting_at_end),
|
796
|
+
("startFrom", start_from),
|
797
|
+
("pageSize", page_size),
|
798
|
+
("forLineage", for_lineage),
|
799
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
800
|
+
]
|
801
|
+
)
|
802
|
+
|
803
|
+
url = (
|
804
|
+
f"{base_path(self, self.view_server)}/related-elements/{guid}/any-type"
|
805
|
+
f"{possible_query_params}"
|
806
|
+
)
|
807
|
+
|
808
|
+
response: Response = await self._async_make_request(
|
809
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
810
|
+
)
|
811
|
+
|
812
|
+
elements = response.json().get("elementList", "No elements found")
|
813
|
+
if type(elements) is list:
|
814
|
+
if len(elements) == 0:
|
815
|
+
return "No elements found"
|
816
|
+
return elements
|
817
|
+
|
818
|
+
def get_all_related_metadata_elements(
|
819
|
+
self,
|
820
|
+
guid: str,
|
821
|
+
body: dict,
|
822
|
+
for_lineage: bool = None,
|
823
|
+
for_duplicate_processing: bool = None,
|
824
|
+
starting_at_end: int = 0,
|
825
|
+
start_from: int = 0,
|
826
|
+
page_size: int = max_paging_size,
|
827
|
+
time_out: int = default_time_out,
|
828
|
+
) -> list | str:
|
829
|
+
"""
|
830
|
+
Retrieve the metadata elements connected to the supplied element.
|
831
|
+
|
832
|
+
Parameters
|
833
|
+
----------
|
834
|
+
guid: str
|
835
|
+
- unique identity of element
|
836
|
+
body: dict
|
837
|
+
- A structure containing the search criteria. (example below)
|
838
|
+
for_lineage: bool, default is set by server
|
839
|
+
- determines if elements classified as Memento should be returned - normally false
|
840
|
+
for_duplicate_processing: bool, default is set by server
|
841
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
842
|
+
starting_at_end: int, default = 0
|
843
|
+
- Relationship end to start from.
|
844
|
+
start_from: int, default = 0
|
845
|
+
- index of the list to start from (0 for start).
|
846
|
+
page_size
|
847
|
+
- maximum number of elements to return.
|
848
|
+
time_out: int, default = default_time_out
|
849
|
+
- http request timeout for this request
|
850
|
+
|
851
|
+
Returns
|
852
|
+
-------
|
853
|
+
[dict] | str
|
854
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
855
|
+
|
856
|
+
Raises
|
857
|
+
------
|
858
|
+
InvalidParameterException
|
859
|
+
one of the parameters is null or invalid or
|
860
|
+
PropertyServerException
|
861
|
+
There is a problem adding the element properties to the metadata repository or
|
862
|
+
UserNotAuthorizedException
|
863
|
+
the requesting user is not authorized to issue this request.
|
864
|
+
|
865
|
+
Notes:
|
866
|
+
|
867
|
+
Sample body:
|
868
|
+
{
|
869
|
+
"class" : "ResultsRequestBody",
|
870
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
871
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
872
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
873
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
874
|
+
"sequencingProperty": "fileName"
|
875
|
+
}
|
876
|
+
|
877
|
+
"""
|
878
|
+
loop = asyncio.get_event_loop()
|
879
|
+
response = loop.run_until_complete(
|
880
|
+
self._async_get_all_related_metadata_elements(
|
881
|
+
guid,
|
882
|
+
body,
|
883
|
+
for_lineage,
|
884
|
+
for_duplicate_processing,
|
885
|
+
starting_at_end,
|
886
|
+
start_from,
|
887
|
+
page_size,
|
888
|
+
time_out,
|
889
|
+
)
|
890
|
+
)
|
891
|
+
return response
|
892
|
+
|
893
|
+
async def _async_get_related_metadata_elements(
|
894
|
+
self,
|
895
|
+
guid: str,
|
896
|
+
relationship_type: str,
|
897
|
+
body: dict,
|
898
|
+
for_lineage: bool = None,
|
899
|
+
for_duplicate_processing: bool = None,
|
900
|
+
starting_at_end: int = 0,
|
901
|
+
start_from: int = 0,
|
902
|
+
page_size: int = max_paging_size,
|
903
|
+
time_out: int = default_time_out,
|
904
|
+
) -> list | str:
|
905
|
+
"""
|
906
|
+
Retrieve the metadata elements connected to the supplied element.
|
907
|
+
Async version.
|
908
|
+
|
909
|
+
Parameters
|
910
|
+
----------
|
911
|
+
guid: str
|
912
|
+
- Unique identity of element to retrieve.
|
913
|
+
relationship_type: str
|
914
|
+
- name of relationship type to retrieve relationships of
|
915
|
+
body: dict
|
916
|
+
- A structure containing the search criteria. (example below)
|
917
|
+
for_lineage: bool, default is set by server
|
918
|
+
- determines if elements classified as Memento should be returned - normally false
|
919
|
+
for_duplicate_processing: bool, default is set by server
|
920
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
921
|
+
starting_at_end: int, default = 0
|
922
|
+
- Relationship end to start from.
|
923
|
+
start_from: int, default = 0
|
924
|
+
- index of the list to start from (0 for start).
|
925
|
+
page_size
|
926
|
+
- maximum number of elements to return.
|
927
|
+
time_out: int, default = default_time_out
|
928
|
+
- http request timeout for this request
|
929
|
+
|
930
|
+
Returns
|
931
|
+
-------
|
932
|
+
[dict] | str
|
933
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
934
|
+
|
935
|
+
Raises
|
936
|
+
------
|
937
|
+
InvalidParameterException
|
938
|
+
one of the parameters is null or invalid or
|
939
|
+
PropertyServerException
|
940
|
+
There is a problem adding the element properties to the metadata repository or
|
941
|
+
UserNotAuthorizedException
|
942
|
+
the requesting user is not authorized to issue this request.
|
943
|
+
|
944
|
+
Notes:
|
945
|
+
|
946
|
+
Sample body:
|
947
|
+
{
|
948
|
+
"class" : "ResultsRequestBody",
|
949
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
950
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
951
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
952
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
953
|
+
"sequencingProperty": "fileName"
|
954
|
+
}
|
955
|
+
|
956
|
+
"""
|
957
|
+
|
958
|
+
possible_query_params = query_string(
|
959
|
+
[
|
960
|
+
("startingAtEnd", starting_at_end),
|
961
|
+
("startFrom", start_from),
|
962
|
+
("pageSize", page_size),
|
963
|
+
("forLineage", for_lineage),
|
964
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
965
|
+
]
|
966
|
+
)
|
967
|
+
|
968
|
+
url = (
|
969
|
+
f"{base_path(self, self.view_server)}/related-elements/{guid}/type/{relationship_type}"
|
970
|
+
f"{possible_query_params}"
|
971
|
+
)
|
972
|
+
|
973
|
+
response: Response = await self._async_make_request(
|
974
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
975
|
+
)
|
976
|
+
|
977
|
+
elements = response.json().get("elementList", "No elements found")
|
978
|
+
if type(elements) is list:
|
979
|
+
if len(elements) == 0:
|
980
|
+
return "No elements found"
|
981
|
+
return elements
|
982
|
+
|
983
|
+
def get_related_metadata_elements(
|
984
|
+
self,
|
985
|
+
guid: str,
|
986
|
+
relationship_type: str,
|
987
|
+
body: dict,
|
988
|
+
for_lineage: bool = None,
|
989
|
+
for_duplicate_processing: bool = None,
|
990
|
+
starting_at_end: int = 0,
|
991
|
+
start_from: int = 0,
|
992
|
+
page_size: int = max_paging_size,
|
993
|
+
time_out: int = default_time_out,
|
994
|
+
) -> list | str:
|
995
|
+
"""
|
996
|
+
Retrieve the metadata elements connected to the supplied element.
|
997
|
+
|
998
|
+
Parameters
|
999
|
+
----------
|
1000
|
+
guid: str
|
1001
|
+
- Unique identity of element to retrieve.
|
1002
|
+
relationship_type: str
|
1003
|
+
- name of relationship type to retrieve relationships of
|
1004
|
+
body: dict
|
1005
|
+
- A structure containing the search criteria. (example below)
|
1006
|
+
for_lineage: bool, default is set by server
|
1007
|
+
- determines if elements classified as Memento should be returned - normally false
|
1008
|
+
for_duplicate_processing: bool, default is set by server
|
1009
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1010
|
+
starting_at_end: int, default = 0
|
1011
|
+
- Relationship end to start from.
|
1012
|
+
start_from: int, default = 0
|
1013
|
+
- index of the list to start from (0 for start).
|
1014
|
+
page_size
|
1015
|
+
- maximum number of elements to return.
|
1016
|
+
time_out: int, default = default_time_out
|
1017
|
+
- http request timeout for this request
|
1018
|
+
|
1019
|
+
Returns
|
1020
|
+
-------
|
1021
|
+
[dict] | str
|
1022
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1023
|
+
|
1024
|
+
Raises
|
1025
|
+
------
|
1026
|
+
InvalidParameterException
|
1027
|
+
one of the parameters is null or invalid or
|
1028
|
+
PropertyServerException
|
1029
|
+
There is a problem adding the element properties to the metadata repository or
|
1030
|
+
UserNotAuthorizedException
|
1031
|
+
the requesting user is not authorized to issue this request.
|
1032
|
+
|
1033
|
+
Notes:
|
1034
|
+
|
1035
|
+
Sample body:
|
1036
|
+
{
|
1037
|
+
"class" : "ResultsRequestBody",
|
1038
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1039
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1040
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1041
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
1042
|
+
"sequencingProperty": "fileName"
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
"""
|
1046
|
+
loop = asyncio.get_event_loop()
|
1047
|
+
response = loop.run_until_complete(
|
1048
|
+
self._async_get_related_metadata_elements(
|
1049
|
+
guid,
|
1050
|
+
relationship_type,
|
1051
|
+
body,
|
1052
|
+
for_lineage,
|
1053
|
+
for_duplicate_processing,
|
1054
|
+
starting_at_end,
|
1055
|
+
start_from,
|
1056
|
+
page_size,
|
1057
|
+
time_out,
|
1058
|
+
)
|
1059
|
+
)
|
1060
|
+
return response
|
1061
|
+
|
1062
|
+
async def _async_get_all_metadata_element_relationships(
|
1063
|
+
self,
|
1064
|
+
end1_guid: str,
|
1065
|
+
end2_guid: str,
|
1066
|
+
body: dict,
|
1067
|
+
for_lineage: bool = None,
|
1068
|
+
for_duplicate_processing: bool = None,
|
1069
|
+
starting_at_end: int = 0,
|
1070
|
+
start_from: int = 0,
|
1071
|
+
page_size: int = max_paging_size,
|
1072
|
+
time_out: int = default_time_out,
|
1073
|
+
) -> list | str:
|
1074
|
+
"""
|
1075
|
+
Retrieve the relationships linking the supplied elements.
|
1076
|
+
Async version.
|
1077
|
+
|
1078
|
+
Parameters
|
1079
|
+
----------
|
1080
|
+
end1_guid: str
|
1081
|
+
- Unique identity of the metadata element at end1 of a relationship.
|
1082
|
+
end2_guid: str
|
1083
|
+
- Unique identity of the metadata element at end2 of a relationship.
|
1084
|
+
body: dict
|
1085
|
+
- A structure containing the search criteria. (example below)
|
1086
|
+
for_lineage: bool, default is set by server
|
1087
|
+
- determines if elements classified as Memento should be returned - normally false
|
1088
|
+
for_duplicate_processing: bool, default is set by server
|
1089
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1090
|
+
starting_at_end: int, default = 0
|
1091
|
+
- Relationship end to start from.
|
1092
|
+
start_from: int, default = 0
|
1093
|
+
- index of the list to start from (0 for start).
|
1094
|
+
page_size
|
1095
|
+
- maximum number of elements to return.
|
1096
|
+
time_out: int, default = default_time_out
|
1097
|
+
- http request timeout for this request
|
1098
|
+
|
1099
|
+
Returns
|
1100
|
+
-------
|
1101
|
+
[dict] | str
|
1102
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1103
|
+
|
1104
|
+
Raises
|
1105
|
+
------
|
1106
|
+
InvalidParameterException
|
1107
|
+
one of the parameters is null or invalid or
|
1108
|
+
PropertyServerException
|
1109
|
+
There is a problem adding the element properties to the metadata repository or
|
1110
|
+
UserNotAuthorizedException
|
1111
|
+
the requesting user is not authorized to issue this request.
|
1112
|
+
|
1113
|
+
Notes:
|
1114
|
+
|
1115
|
+
Sample body:
|
1116
|
+
{
|
1117
|
+
"class" : "ResultsRequestBody",
|
1118
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1119
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1120
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1121
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
1122
|
+
"sequencingProperty": "fileName"
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
"""
|
1126
|
+
|
1127
|
+
possible_query_params = query_string(
|
1128
|
+
[
|
1129
|
+
("startingAtEnd", starting_at_end),
|
1130
|
+
("startFrom", start_from),
|
1131
|
+
("pageSize", page_size),
|
1132
|
+
("forLineage", for_lineage),
|
1133
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1134
|
+
]
|
1135
|
+
)
|
1136
|
+
|
1137
|
+
url = (
|
1138
|
+
f"{base_path(self, self.view_server)}/metadata-elements/{end1_guid}/linked-by-any-type/"
|
1139
|
+
f"to-elements/{end2_guid}"
|
1140
|
+
f"{possible_query_params}"
|
1141
|
+
)
|
1142
|
+
|
1143
|
+
response: Response = await self._async_make_request(
|
1144
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
1145
|
+
)
|
1146
|
+
|
1147
|
+
elements = response.json().get("elementList", "No elements found")
|
1148
|
+
if type(elements) is list:
|
1149
|
+
if len(elements) == 0:
|
1150
|
+
return "No elements found"
|
1151
|
+
return elements
|
1152
|
+
|
1153
|
+
def get_all_metadata_element_relationships(
|
1154
|
+
self,
|
1155
|
+
end1_guid: str,
|
1156
|
+
end2_guid: str,
|
1157
|
+
body: dict,
|
1158
|
+
for_lineage: bool = None,
|
1159
|
+
for_duplicate_processing: bool = None,
|
1160
|
+
starting_at_end: int = 0,
|
1161
|
+
start_from: int = 0,
|
1162
|
+
page_size: int = max_paging_size,
|
1163
|
+
time_out: int = default_time_out,
|
1164
|
+
) -> list | str:
|
1165
|
+
"""
|
1166
|
+
Retrieve the relationships linking the supplied elements.
|
1167
|
+
|
1168
|
+
Parameters
|
1169
|
+
----------
|
1170
|
+
end1_guid: str
|
1171
|
+
- Unique identity of the metadata element at end1 of a relationship.
|
1172
|
+
end2_guid: str
|
1173
|
+
- Unique identity of the metadata element at end2 of a relationship.
|
1174
|
+
body: dict
|
1175
|
+
- A structure containing the search criteria. (example below)
|
1176
|
+
for_lineage: bool, default is set by server
|
1177
|
+
- determines if elements classified as Memento should be returned - normally false
|
1178
|
+
for_duplicate_processing: bool, default is set by server
|
1179
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1180
|
+
starting_at_end: int, default = 0
|
1181
|
+
- Relationship end to start from.
|
1182
|
+
start_from: int, default = 0
|
1183
|
+
- index of the list to start from (0 for start).
|
1184
|
+
page_size
|
1185
|
+
- maximum number of elements to return.
|
1186
|
+
time_out: int, default = default_time_out
|
1187
|
+
- http request timeout for this request
|
1188
|
+
|
1189
|
+
Returns
|
1190
|
+
-------
|
1191
|
+
[dict] | str
|
1192
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1193
|
+
|
1194
|
+
Raises
|
1195
|
+
------
|
1196
|
+
InvalidParameterException
|
1197
|
+
one of the parameters is null or invalid or
|
1198
|
+
PropertyServerException
|
1199
|
+
There is a problem adding the element properties to the metadata repository or
|
1200
|
+
UserNotAuthorizedException
|
1201
|
+
the requesting user is not authorized to issue this request.
|
1202
|
+
|
1203
|
+
Notes:
|
1204
|
+
|
1205
|
+
Sample body:
|
1206
|
+
{
|
1207
|
+
"class" : "ResultsRequestBody",
|
1208
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1209
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1210
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1211
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
1212
|
+
"sequencingProperty": "fileName"
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
"""
|
1216
|
+
loop = asyncio.get_event_loop()
|
1217
|
+
response = loop.run_until_complete(
|
1218
|
+
self._async_get_all_metadata_element_relationships(
|
1219
|
+
end1_guid,
|
1220
|
+
end2_guid,
|
1221
|
+
body,
|
1222
|
+
for_lineage,
|
1223
|
+
for_duplicate_processing,
|
1224
|
+
starting_at_end,
|
1225
|
+
start_from,
|
1226
|
+
page_size,
|
1227
|
+
time_out,
|
1228
|
+
)
|
1229
|
+
)
|
1230
|
+
return response
|
1231
|
+
|
1232
|
+
async def _async_get_metadata_element_relationships(
|
1233
|
+
self,
|
1234
|
+
end1_guid: str,
|
1235
|
+
end2_guid: str,
|
1236
|
+
relationship_type: str,
|
1237
|
+
body: dict,
|
1238
|
+
for_lineage: bool = None,
|
1239
|
+
for_duplicate_processing: bool = None,
|
1240
|
+
starting_at_end: int = 0,
|
1241
|
+
start_from: int = 0,
|
1242
|
+
page_size: int = max_paging_size,
|
1243
|
+
time_out: int = default_time_out,
|
1244
|
+
) -> list | str:
|
1245
|
+
"""
|
1246
|
+
Retrieve the relationships linking the supplied elements.
|
1247
|
+
Async version.
|
1248
|
+
|
1249
|
+
Parameters
|
1250
|
+
----------
|
1251
|
+
end1_guid: str
|
1252
|
+
- Unique identity of the metadata element at end1 of a relationship.
|
1253
|
+
end2_guid: str
|
1254
|
+
- Unique identity of the metadata element at end2 of a relationship.
|
1255
|
+
relationship_type: str
|
1256
|
+
- name of relationship type to retrieve relationships of
|
1257
|
+
body: dict
|
1258
|
+
- A structure containing the search criteria. (example below)
|
1259
|
+
for_lineage: bool, default is set by server
|
1260
|
+
- determines if elements classified as Memento should be returned - normally false
|
1261
|
+
for_duplicate_processing: bool, default is set by server
|
1262
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1263
|
+
starting_at_end: int, default = 0
|
1264
|
+
- Relationship end to start from.
|
1265
|
+
start_from: int, default = 0
|
1266
|
+
- index of the list to start from (0 for start).
|
1267
|
+
page_size
|
1268
|
+
- maximum number of elements to return.
|
1269
|
+
time_out: int, default = default_time_out
|
1270
|
+
- http request timeout for this request
|
1271
|
+
|
1272
|
+
Returns
|
1273
|
+
-------
|
1274
|
+
[dict] | str
|
1275
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1276
|
+
|
1277
|
+
Raises
|
1278
|
+
------
|
1279
|
+
InvalidParameterException
|
1280
|
+
one of the parameters is null or invalid or
|
1281
|
+
PropertyServerException
|
1282
|
+
There is a problem adding the element properties to the metadata repository or
|
1283
|
+
UserNotAuthorizedException
|
1284
|
+
the requesting user is not authorized to issue this request.
|
1285
|
+
|
1286
|
+
Notes:
|
1287
|
+
|
1288
|
+
Sample body:
|
1289
|
+
{
|
1290
|
+
"class" : "ResultsRequestBody",
|
1291
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1292
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1293
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1294
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
1295
|
+
"sequencingProperty": "fileName"
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
"""
|
1299
|
+
|
1300
|
+
possible_query_params = query_string(
|
1301
|
+
[
|
1302
|
+
("startingAtEnd", starting_at_end),
|
1303
|
+
("startFrom", start_from),
|
1304
|
+
("pageSize", page_size),
|
1305
|
+
("forLineage", for_lineage),
|
1306
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1307
|
+
]
|
1308
|
+
)
|
1309
|
+
|
1310
|
+
url = (
|
1311
|
+
f"{base_path(self, self.view_server)}/metadata-elements/{end1_guid}/linked-by-type/"
|
1312
|
+
f"{relationship_type}/to-elements/{end2_guid}"
|
1313
|
+
f"{possible_query_params}"
|
1314
|
+
)
|
1315
|
+
|
1316
|
+
response: Response = await self._async_make_request(
|
1317
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
1318
|
+
)
|
1319
|
+
|
1320
|
+
elements = response.json().get("elementList", "No elements found")
|
1321
|
+
if type(elements) is list:
|
1322
|
+
if len(elements) == 0:
|
1323
|
+
return "No elements found"
|
1324
|
+
return elements
|
1325
|
+
|
1326
|
+
def get_metadata_element_relationships(
|
1327
|
+
self,
|
1328
|
+
end1_guid: str,
|
1329
|
+
end2_guid: str,
|
1330
|
+
relationship_type: str,
|
1331
|
+
body: dict,
|
1332
|
+
for_lineage: bool = None,
|
1333
|
+
for_duplicate_processing: bool = None,
|
1334
|
+
starting_at_end: int = 0,
|
1335
|
+
start_from: int = 0,
|
1336
|
+
page_size: int = max_paging_size,
|
1337
|
+
time_out: int = default_time_out,
|
1338
|
+
) -> list | str:
|
1339
|
+
"""
|
1340
|
+
Retrieve the relationships linking the supplied elements.
|
1341
|
+
|
1342
|
+
Parameters
|
1343
|
+
----------
|
1344
|
+
end1_guid: str
|
1345
|
+
- Unique identity of the metadata element at end1 of a relationship.
|
1346
|
+
end2_guid: str
|
1347
|
+
- Unique identity of the metadata element at end2 of a relationship.
|
1348
|
+
relationship_type: str
|
1349
|
+
- name of relationship type to retrieve relationships of
|
1350
|
+
body: dict
|
1351
|
+
- A structure containing the search criteria. (example below)
|
1352
|
+
for_lineage: bool, default is set by server
|
1353
|
+
- determines if elements classified as Memento should be returned - normally false
|
1354
|
+
for_duplicate_processing: bool, default is set by server
|
1355
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1356
|
+
starting_at_end: int, default = 0
|
1357
|
+
- Relationship end to start from.
|
1358
|
+
start_from: int, default = 0
|
1359
|
+
- index of the list to start from (0 for start).
|
1360
|
+
page_size
|
1361
|
+
- maximum number of elements to return.
|
1362
|
+
time_out: int, default = default_time_out
|
1363
|
+
- http request timeout for this request
|
1364
|
+
|
1365
|
+
Returns
|
1366
|
+
-------
|
1367
|
+
[dict] | str
|
1368
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1369
|
+
|
1370
|
+
Raises
|
1371
|
+
------
|
1372
|
+
InvalidParameterException
|
1373
|
+
one of the parameters is null or invalid or
|
1374
|
+
PropertyServerException
|
1375
|
+
There is a problem adding the element properties to the metadata repository or
|
1376
|
+
UserNotAuthorizedException
|
1377
|
+
the requesting user is not authorized to issue this request.
|
1378
|
+
|
1379
|
+
Notes:
|
1380
|
+
|
1381
|
+
Sample body:
|
1382
|
+
{
|
1383
|
+
"class" : "ResultsRequestBody",
|
1384
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1385
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1386
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1387
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
1388
|
+
"sequencingProperty": "fileName"
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
"""
|
1392
|
+
loop = asyncio.get_event_loop()
|
1393
|
+
response = loop.run_until_complete(
|
1394
|
+
self._async_get_metadata_element_relationships(
|
1395
|
+
end1_guid,
|
1396
|
+
end2_guid,
|
1397
|
+
relationship_type,
|
1398
|
+
body,
|
1399
|
+
for_lineage,
|
1400
|
+
for_duplicate_processing,
|
1401
|
+
starting_at_end,
|
1402
|
+
start_from,
|
1403
|
+
page_size,
|
1404
|
+
time_out,
|
1405
|
+
)
|
1406
|
+
)
|
1407
|
+
return response
|
1408
|
+
|
1409
|
+
async def _async_find_metadata_elements(
|
1410
|
+
self,
|
1411
|
+
body: dict,
|
1412
|
+
for_lineage: bool = None,
|
1413
|
+
for_duplicate_processing: bool = None,
|
1414
|
+
start_from: int = 0,
|
1415
|
+
page_size: int = max_paging_size,
|
1416
|
+
time_out: int = default_time_out,
|
1417
|
+
) -> list | str:
|
1418
|
+
"""Return a list of metadata elements that match the supplied criteria.
|
1419
|
+
The results can be returned over many pages. Async version.
|
1420
|
+
|
1421
|
+
Parameters
|
1422
|
+
----------
|
1423
|
+
body: dict
|
1424
|
+
- A structure containing the search criteria. (example below)
|
1425
|
+
for_lineage: bool, default is set by server
|
1426
|
+
- determines if elements classified as Memento should be returned - normally false
|
1427
|
+
for_duplicate_processing: bool, default is set by server
|
1428
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1429
|
+
start_from: int, default = 0
|
1430
|
+
- index of the list to start from (0 for start).
|
1431
|
+
page_size
|
1432
|
+
- maximum number of elements to return.
|
1433
|
+
time_out: int, default = default_time_out
|
1434
|
+
- http request timeout for this request
|
1435
|
+
|
1436
|
+
Returns
|
1437
|
+
-------
|
1438
|
+
[dict] | str
|
1439
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1440
|
+
|
1441
|
+
Raises
|
1442
|
+
------
|
1443
|
+
InvalidParameterException
|
1444
|
+
one of the parameters is null or invalid or
|
1445
|
+
PropertyServerException
|
1446
|
+
There is a problem adding the element properties to the metadata repository or
|
1447
|
+
UserNotAuthorizedException
|
1448
|
+
the requesting user is not authorized to issue this request.
|
1449
|
+
|
1450
|
+
Notes:
|
1451
|
+
|
1452
|
+
Sample body:
|
1453
|
+
{
|
1454
|
+
"class" : "FindRequestBody",
|
1455
|
+
"metadataElementTypeName": "add typeName here",
|
1456
|
+
"metadataElementSubtypeNames": [],
|
1457
|
+
"searchProperties": {
|
1458
|
+
"class" : "SearchProperties",
|
1459
|
+
"conditions": [ {
|
1460
|
+
"nestedConditions": {
|
1461
|
+
"class" : "SearchProperties",
|
1462
|
+
"conditions": [
|
1463
|
+
{
|
1464
|
+
"property" : "add name of property here",
|
1465
|
+
"operator": "EQ",
|
1466
|
+
"value": {
|
1467
|
+
"class" : "PrimitiveTypePropertyValue",
|
1468
|
+
"typeName" : "string",
|
1469
|
+
"primitiveValue" : "Add value here"
|
1470
|
+
}
|
1471
|
+
}],
|
1472
|
+
"matchCriteria": "ALL"
|
1473
|
+
}
|
1474
|
+
}],
|
1475
|
+
"matchCriteria": "ANY"
|
1476
|
+
},
|
1477
|
+
"matchClassifications": {
|
1478
|
+
"class" : "SearchClassifications",
|
1479
|
+
"conditions": [{
|
1480
|
+
"name" : "add classification name here",
|
1481
|
+
"searchProperties": {
|
1482
|
+
"class" : "SearchProperties",
|
1483
|
+
"conditions": [
|
1484
|
+
{
|
1485
|
+
"property" : "add name of property here",
|
1486
|
+
"operator": "EQ",
|
1487
|
+
"value": {
|
1488
|
+
"class" : "PrimitiveTypePropertyValue",
|
1489
|
+
"typeName" : "string",
|
1490
|
+
"primitiveValue" : "Add value here"
|
1491
|
+
}
|
1492
|
+
}],
|
1493
|
+
"matchCriteria": "ALL"
|
1494
|
+
}
|
1495
|
+
}],
|
1496
|
+
"matchCriteria": "ANY"
|
1497
|
+
},
|
1498
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1499
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1500
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1501
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
1502
|
+
"sequencingProperty": ""
|
1503
|
+
}
|
1504
|
+
"""
|
1505
|
+
|
1506
|
+
possible_query_params = query_string(
|
1507
|
+
[
|
1508
|
+
("startFrom", start_from),
|
1509
|
+
("pageSize", page_size),
|
1510
|
+
("forLineage", for_lineage),
|
1511
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1512
|
+
]
|
1513
|
+
)
|
1514
|
+
|
1515
|
+
url = (
|
1516
|
+
f"{base_path(self, self.view_server)}/metadata-elements/by-search-specification"
|
1517
|
+
f"{possible_query_params}"
|
1518
|
+
)
|
1519
|
+
|
1520
|
+
response: Response = await self._async_make_request(
|
1521
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
1522
|
+
)
|
1523
|
+
|
1524
|
+
elements = response.json().get("elementList", "No elements found")
|
1525
|
+
if type(elements) is list:
|
1526
|
+
if len(elements) == 0:
|
1527
|
+
return "No elements found"
|
1528
|
+
return elements
|
1529
|
+
|
1530
|
+
def find_metadata_elements(
|
1531
|
+
self,
|
1532
|
+
body: dict,
|
1533
|
+
for_lineage: bool = None,
|
1534
|
+
for_duplicate_processing: bool = None,
|
1535
|
+
start_from: int = 0,
|
1536
|
+
page_size: int = max_paging_size,
|
1537
|
+
time_out: int = default_time_out,
|
1538
|
+
) -> list | str:
|
1539
|
+
"""
|
1540
|
+
Retrieve the relationships linking the supplied elements.
|
1541
|
+
|
1542
|
+
Parameters
|
1543
|
+
----------
|
1544
|
+
body: dict
|
1545
|
+
- A structure containing the search criteria. (example below)
|
1546
|
+
for_lineage: bool, default is set by server
|
1547
|
+
- determines if elements classified as Memento should be returned - normally false
|
1548
|
+
for_duplicate_processing: bool, default is set by server
|
1549
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1550
|
+
start_from: int, default = 0
|
1551
|
+
- index of the list to start from (0 for start).
|
1552
|
+
page_size
|
1553
|
+
- maximum number of elements to return.
|
1554
|
+
time_out: int, default = default_time_out
|
1555
|
+
- http request timeout for this request
|
1556
|
+
|
1557
|
+
Returns
|
1558
|
+
-------
|
1559
|
+
[dict] | str
|
1560
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1561
|
+
|
1562
|
+
Raises
|
1563
|
+
------
|
1564
|
+
InvalidParameterException
|
1565
|
+
one of the parameters is null or invalid or
|
1566
|
+
PropertyServerException
|
1567
|
+
There is a problem adding the element properties to the metadata repository or
|
1568
|
+
UserNotAuthorizedException
|
1569
|
+
the requesting user is not authorized to issue this request.
|
1570
|
+
|
1571
|
+
Notes:
|
1572
|
+
|
1573
|
+
Sample body:
|
1574
|
+
{
|
1575
|
+
"class" : "FindRequestBody",
|
1576
|
+
"metadataElementTypeName": "add typeName here",
|
1577
|
+
"metadataElementSubtypeNames": [],
|
1578
|
+
"searchProperties": {
|
1579
|
+
"class" : "SearchProperties",
|
1580
|
+
"conditions": [ {
|
1581
|
+
"nestedConditions": {
|
1582
|
+
"class" : "SearchProperties",
|
1583
|
+
"conditions": [
|
1584
|
+
{
|
1585
|
+
"property" : "add name of property here",
|
1586
|
+
"operator": "EQ",
|
1587
|
+
"value": {
|
1588
|
+
"class" : "PrimitiveTypePropertyValue",
|
1589
|
+
"typeName" : "string",
|
1590
|
+
"primitiveValue" : "Add value here"
|
1591
|
+
}
|
1592
|
+
}],
|
1593
|
+
"matchCriteria": "ALL"
|
1594
|
+
}
|
1595
|
+
}],
|
1596
|
+
"matchCriteria": "ANY"
|
1597
|
+
},
|
1598
|
+
"matchClassifications": {
|
1599
|
+
"class" : "SearchClassifications",
|
1600
|
+
"conditions": [{
|
1601
|
+
"name" : "add classification name here",
|
1602
|
+
"searchProperties": {
|
1603
|
+
"class" : "SearchProperties",
|
1604
|
+
"conditions": [
|
1605
|
+
{
|
1606
|
+
"property" : "add name of property here",
|
1607
|
+
"operator": "EQ",
|
1608
|
+
"value": {
|
1609
|
+
"class" : "PrimitiveTypePropertyValue",
|
1610
|
+
"typeName" : "string",
|
1611
|
+
"primitiveValue" : "Add value here"
|
1612
|
+
}
|
1613
|
+
}],
|
1614
|
+
"matchCriteria": "ALL"
|
1615
|
+
}
|
1616
|
+
}],
|
1617
|
+
"matchCriteria": "ANY"
|
1618
|
+
},
|
1619
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1620
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1621
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1622
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
1623
|
+
"sequencingProperty": ""
|
1624
|
+
}
|
1625
|
+
|
1626
|
+
"""
|
1627
|
+
loop = asyncio.get_event_loop()
|
1628
|
+
response = loop.run_until_complete(
|
1629
|
+
self._async_find_metadata_elements(
|
1630
|
+
body,
|
1631
|
+
for_lineage,
|
1632
|
+
for_duplicate_processing,
|
1633
|
+
start_from,
|
1634
|
+
page_size,
|
1635
|
+
time_out,
|
1636
|
+
)
|
1637
|
+
)
|
1638
|
+
return response
|
1639
|
+
|
1640
|
+
async def _async_find_relationships_between_elements(
|
1641
|
+
self,
|
1642
|
+
body: dict,
|
1643
|
+
for_lineage: bool = None,
|
1644
|
+
for_duplicate_processing: bool = None,
|
1645
|
+
start_from: int = 0,
|
1646
|
+
page_size: int = max_paging_size,
|
1647
|
+
time_out: int = default_time_out,
|
1648
|
+
) -> list | str:
|
1649
|
+
"""Return a list of relationships that match the requested conditions.
|
1650
|
+
The results can be received as a series of pages. Async version.
|
1651
|
+
|
1652
|
+
Parameters
|
1653
|
+
----------
|
1654
|
+
body: dict
|
1655
|
+
- A structure containing the search criteria. (example below)
|
1656
|
+
for_lineage: bool, default is set by server
|
1657
|
+
- determines if elements classified as Memento should be returned - normally false
|
1658
|
+
for_duplicate_processing: bool, default is set by server
|
1659
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1660
|
+
start_from: int, default = 0
|
1661
|
+
- index of the list to start from (0 for start).
|
1662
|
+
page_size
|
1663
|
+
- maximum number of elements to return.
|
1664
|
+
time_out: int, default = default_time_out
|
1665
|
+
- http request timeout for this request
|
1666
|
+
|
1667
|
+
Returns
|
1668
|
+
-------
|
1669
|
+
[dict] | str
|
1670
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1671
|
+
|
1672
|
+
Raises
|
1673
|
+
------
|
1674
|
+
InvalidParameterException
|
1675
|
+
one of the parameters is null or invalid or
|
1676
|
+
PropertyServerException
|
1677
|
+
There is a problem adding the element properties to the metadata repository or
|
1678
|
+
UserNotAuthorizedException
|
1679
|
+
the requesting user is not authorized to issue this request.
|
1680
|
+
|
1681
|
+
Notes:
|
1682
|
+
|
1683
|
+
Sample body:
|
1684
|
+
{
|
1685
|
+
"class" : "FindRelationshipRequestBody",
|
1686
|
+
"relationshipTypeName": "add typeName here",
|
1687
|
+
"searchProperties": {
|
1688
|
+
"class" : "SearchProperties",
|
1689
|
+
"conditions": [ {
|
1690
|
+
"nestedConditions": {
|
1691
|
+
"class" : "SearchProperties",
|
1692
|
+
"conditions": [
|
1693
|
+
{
|
1694
|
+
"property" : "add name of property here",
|
1695
|
+
"operator": "EQ",
|
1696
|
+
"value": {
|
1697
|
+
"class" : "PrimitiveTypePropertyValue",
|
1698
|
+
"typeName" : "string",
|
1699
|
+
"primitiveValue" : "Add value here"
|
1700
|
+
}
|
1701
|
+
}],
|
1702
|
+
"matchCriteria": "ALL"
|
1703
|
+
}
|
1704
|
+
}],
|
1705
|
+
"matchCriteria": "ANY"
|
1706
|
+
},
|
1707
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1708
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1709
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1710
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
1711
|
+
"sequencingProperty": ""
|
1712
|
+
}
|
1713
|
+
"""
|
1714
|
+
|
1715
|
+
possible_query_params = query_string(
|
1716
|
+
[
|
1717
|
+
("startFrom", start_from),
|
1718
|
+
("pageSize", page_size),
|
1719
|
+
("forLineage", for_lineage),
|
1720
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1721
|
+
]
|
1722
|
+
)
|
1723
|
+
|
1724
|
+
url = (
|
1725
|
+
f"{base_path(self, self.view_server)}/relationships/by-search-specification"
|
1726
|
+
f"{possible_query_params}"
|
1727
|
+
)
|
1728
|
+
|
1729
|
+
response: Response = await self._async_make_request(
|
1730
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
1731
|
+
)
|
1732
|
+
|
1733
|
+
elements = response.json().get("elementList", "No elements found")
|
1734
|
+
if type(elements) is list:
|
1735
|
+
if len(elements) == 0:
|
1736
|
+
return "No elements found"
|
1737
|
+
return elements
|
1738
|
+
|
1739
|
+
def find_relationships_between_elements(
|
1740
|
+
self,
|
1741
|
+
body: dict,
|
1742
|
+
for_lineage: bool = None,
|
1743
|
+
for_duplicate_processing: bool = None,
|
1744
|
+
start_from: int = 0,
|
1745
|
+
page_size: int = max_paging_size,
|
1746
|
+
time_out: int = default_time_out,
|
1747
|
+
) -> list | str:
|
1748
|
+
"""Return a list of relationships that match the requested conditions.
|
1749
|
+
The results can be received as a series of pages.
|
1750
|
+
|
1751
|
+
Parameters
|
1752
|
+
----------
|
1753
|
+
body: dict
|
1754
|
+
- A structure containing the search criteria. (example below)
|
1755
|
+
for_lineage: bool, default is set by server
|
1756
|
+
- determines if elements classified as Memento should be returned - normally false
|
1757
|
+
for_duplicate_processing: bool, default is set by server
|
1758
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1759
|
+
start_from: int, default = 0
|
1760
|
+
- index of the list to start from (0 for start).
|
1761
|
+
page_size
|
1762
|
+
- maximum number of elements to return.
|
1763
|
+
time_out: int, default = default_time_out
|
1764
|
+
- http request timeout for this request
|
1765
|
+
|
1766
|
+
Returns
|
1767
|
+
-------
|
1768
|
+
[dict] | str
|
1769
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1770
|
+
|
1771
|
+
Raises
|
1772
|
+
------
|
1773
|
+
InvalidParameterException
|
1774
|
+
one of the parameters is null or invalid or
|
1775
|
+
PropertyServerException
|
1776
|
+
There is a problem adding the element properties to the metadata repository or
|
1777
|
+
UserNotAuthorizedException
|
1778
|
+
the requesting user is not authorized to issue this request.
|
1779
|
+
|
1780
|
+
Notes:
|
1781
|
+
|
1782
|
+
Sample body:
|
1783
|
+
{
|
1784
|
+
"class" : "FindRelationshipRequestBody",
|
1785
|
+
"relationshipTypeName": "add typeName here",
|
1786
|
+
"searchProperties": {
|
1787
|
+
"class" : "SearchProperties",
|
1788
|
+
"conditions": [ {
|
1789
|
+
"nestedConditions": {
|
1790
|
+
"class" : "SearchProperties",
|
1791
|
+
"conditions": [
|
1792
|
+
{
|
1793
|
+
"property" : "add name of property here",
|
1794
|
+
"operator": "EQ",
|
1795
|
+
"value": {
|
1796
|
+
"class" : "PrimitiveTypePropertyValue",
|
1797
|
+
"typeName" : "string",
|
1798
|
+
"primitiveValue" : "Add value here"
|
1799
|
+
}
|
1800
|
+
}],
|
1801
|
+
"matchCriteria": "ALL"
|
1802
|
+
}
|
1803
|
+
}],
|
1804
|
+
"matchCriteria": "ANY"
|
1805
|
+
},
|
1806
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
1807
|
+
"limitResultsByStatus" : ["ACTIVE"],
|
1808
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
1809
|
+
"sequencingOrder": "CREATION_DATE_RECENT",
|
1810
|
+
"sequencingProperty": ""
|
1811
|
+
}
|
1812
|
+
|
1813
|
+
"""
|
1814
|
+
loop = asyncio.get_event_loop()
|
1815
|
+
response = loop.run_until_complete(
|
1816
|
+
self._async_find_relationships_between_elements(
|
1817
|
+
body,
|
1818
|
+
for_lineage,
|
1819
|
+
for_duplicate_processing,
|
1820
|
+
start_from,
|
1821
|
+
page_size,
|
1822
|
+
time_out,
|
1823
|
+
)
|
1824
|
+
)
|
1825
|
+
return response
|
1826
|
+
|
1827
|
+
async def _async_get_relationship_by_guid(
|
1828
|
+
self,
|
1829
|
+
guid: str,
|
1830
|
+
effective_time: str = None,
|
1831
|
+
for_lineage: bool = None,
|
1832
|
+
for_duplicate_processing: bool = None,
|
1833
|
+
) -> dict | str:
|
1834
|
+
"""
|
1835
|
+
Retrieve the relationship using its unique identifier. Async version.
|
1836
|
+
|
1837
|
+
Parameters
|
1838
|
+
----------
|
1839
|
+
guid : str
|
1840
|
+
- unique identifier of the relationship to retrieve
|
1841
|
+
effective_time: str, default = None
|
1842
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1843
|
+
for_lineage: bool, default is set by server
|
1844
|
+
- determines if elements classified as Memento should be returned - normally false
|
1845
|
+
for_duplicate_processing: bool, default is set by server
|
1846
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1847
|
+
|
1848
|
+
Returns
|
1849
|
+
-------
|
1850
|
+
dict | str
|
1851
|
+
If the relationship is found, a dict of the relationship details is returned. Otherwise, the string "No element found".
|
1852
|
+
|
1853
|
+
Raises
|
1854
|
+
------
|
1855
|
+
InvalidParameterException
|
1856
|
+
one of the parameters is null or invalid or
|
1857
|
+
PropertyServerException
|
1858
|
+
There is a problem adding the element properties to the metadata repository or
|
1859
|
+
UserNotAuthorizedException
|
1860
|
+
the requesting user is not authorized to issue this request.
|
1861
|
+
"""
|
1862
|
+
|
1863
|
+
possible_query_params = query_string(
|
1864
|
+
[
|
1865
|
+
("forLineage", for_lineage),
|
1866
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1867
|
+
]
|
1868
|
+
)
|
1869
|
+
|
1870
|
+
body = {
|
1871
|
+
"class": "EffectiveTimeRequestBody",
|
1872
|
+
"effectiveTime": effective_time,
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
url = (
|
1876
|
+
f"{base_path(self, self.view_server)}/relationships/by-guid/{guid}"
|
1877
|
+
f"{possible_query_params}"
|
1878
|
+
)
|
1879
|
+
response: Response = await self._async_make_request(
|
1880
|
+
"POST", url, body_slimmer(body)
|
1881
|
+
)
|
1882
|
+
return response.json().get("element", "No elements found")
|
1883
|
+
|
1884
|
+
def get_relationship_by_guid(
|
1885
|
+
self,
|
1886
|
+
guid: str,
|
1887
|
+
effective_time: str = None,
|
1888
|
+
for_lineage: bool = None,
|
1889
|
+
for_duplicate_processing: bool = None,
|
1890
|
+
) -> dict | str:
|
1891
|
+
"""
|
1892
|
+
Retrieve the relationship using its unique identifier.
|
1893
|
+
|
1894
|
+
Parameters
|
1895
|
+
----------
|
1896
|
+
guid : str
|
1897
|
+
- unique identifier of the relationship to retrieve
|
1898
|
+
effective_time: str, default = None
|
1899
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1900
|
+
for_lineage: bool, default is set by server
|
1901
|
+
- determines if elements classified as Memento should be returned - normally false
|
1902
|
+
for_duplicate_processing: bool, default is set by server
|
1903
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1904
|
+
|
1905
|
+
Returns
|
1906
|
+
-------
|
1907
|
+
dict | str
|
1908
|
+
If the relationship is found, a dict of the relationship details is returned. Otherwise, the string "No element found".
|
1909
|
+
|
1910
|
+
Raises
|
1911
|
+
------
|
1912
|
+
InvalidParameterException
|
1913
|
+
one of the parameters is null or invalid or
|
1914
|
+
PropertyServerException
|
1915
|
+
There is a problem adding the element properties to the metadata repository or
|
1916
|
+
UserNotAuthorizedException
|
1917
|
+
the requesting user is not authorized to issue this request.
|
1918
|
+
"""
|
1919
|
+
|
1920
|
+
loop = asyncio.get_event_loop()
|
1921
|
+
response = loop.run_until_complete(
|
1922
|
+
self._async_get_relationship_by_guid(
|
1923
|
+
guid, effective_time, for_lineage, for_duplicate_processing
|
1924
|
+
)
|
1925
|
+
)
|
1926
|
+
return response
|
1927
|
+
|
1928
|
+
async def _async_get_relationship_history(
|
1929
|
+
self,
|
1930
|
+
guid: str,
|
1931
|
+
effective_time: str = None,
|
1932
|
+
oldest_first: bool = False,
|
1933
|
+
from_time: str = None,
|
1934
|
+
to_time: str = None,
|
1935
|
+
for_lineage: bool = None,
|
1936
|
+
for_duplicate_processing: bool = None,
|
1937
|
+
start_from: int = 0,
|
1938
|
+
page_size: int = max_paging_size,
|
1939
|
+
time_out: int = default_time_out,
|
1940
|
+
) -> list | str:
|
1941
|
+
"""
|
1942
|
+
Retrieve all the versions of a relationship. Async version.
|
1943
|
+
|
1944
|
+
Parameters
|
1945
|
+
----------
|
1946
|
+
guid: str
|
1947
|
+
- Unique identity of element to retrieve.
|
1948
|
+
effective_time: str, default = None
|
1949
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1950
|
+
oldest_first: bool, default = False
|
1951
|
+
from_time: str, default = None
|
1952
|
+
Time to begin returning history
|
1953
|
+
to_time: str, default = None
|
1954
|
+
Time to end returning history
|
1955
|
+
for_lineage: bool, default is set by server
|
1956
|
+
- determines if elements classified as Memento should be returned - normally false
|
1957
|
+
for_duplicate_processing: bool, default is set by server
|
1958
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
1959
|
+
start_from: int, default = 0
|
1960
|
+
- index of the list to start from (0 for start).
|
1961
|
+
page_size
|
1962
|
+
- maximum number of elements to return.
|
1963
|
+
time_out: int, default = default_time_out
|
1964
|
+
- http request timeout for this request
|
1965
|
+
|
1966
|
+
Returns
|
1967
|
+
-------
|
1968
|
+
[dict] | str
|
1969
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
1970
|
+
|
1971
|
+
Raises
|
1972
|
+
------
|
1973
|
+
InvalidParameterException
|
1974
|
+
one of the parameters is null or invalid or
|
1975
|
+
PropertyServerException
|
1976
|
+
There is a problem adding the element properties to the metadata repository or
|
1977
|
+
UserNotAuthorizedException
|
1978
|
+
the requesting user is not authorized to issue this request.
|
1979
|
+
"""
|
1980
|
+
|
1981
|
+
possible_query_params = query_string(
|
1982
|
+
[
|
1983
|
+
("startFrom", start_from),
|
1984
|
+
("pageSize", page_size),
|
1985
|
+
("oldestFirst", oldest_first),
|
1986
|
+
("forLineage", for_lineage),
|
1987
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
1988
|
+
]
|
1989
|
+
)
|
1990
|
+
|
1991
|
+
body = {
|
1992
|
+
"class": "HistoryRequestBody",
|
1993
|
+
"effectiveTime": effective_time,
|
1994
|
+
"fromTime": from_time,
|
1995
|
+
"toTime": to_time,
|
1996
|
+
}
|
1997
|
+
|
1998
|
+
url = (
|
1999
|
+
f"{base_path(self, self.view_server)}/relationships/{guid}/history"
|
2000
|
+
f"{possible_query_params}"
|
2001
|
+
)
|
2002
|
+
|
2003
|
+
response: Response = await self._async_make_request(
|
2004
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
2005
|
+
)
|
2006
|
+
|
2007
|
+
elements = response.json().get("elementList", "No elements found")
|
2008
|
+
if type(elements) is list:
|
2009
|
+
if len(elements) == 0:
|
2010
|
+
return "No elements found"
|
2011
|
+
return elements
|
2012
|
+
|
2013
|
+
def get_relationship_history(
|
2014
|
+
self,
|
2015
|
+
guid: str,
|
2016
|
+
effective_time: str = None,
|
2017
|
+
oldest_first: bool = False,
|
2018
|
+
from_time: str = None,
|
2019
|
+
to_time: str = None,
|
2020
|
+
for_lineage: bool = None,
|
2021
|
+
for_duplicate_processing: bool = None,
|
2022
|
+
start_from: int = 0,
|
2023
|
+
page_size: int = max_paging_size,
|
2024
|
+
time_out: int = default_time_out,
|
2025
|
+
) -> list | str:
|
2026
|
+
"""
|
2027
|
+
Retrieve all the versions of a relationship.
|
2028
|
+
|
2029
|
+
Parameters
|
2030
|
+
----------
|
2031
|
+
guid: str
|
2032
|
+
- Unique identity of element to retrieve.
|
2033
|
+
effective_time: str, default = None
|
2034
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
2035
|
+
oldest_first: bool, default = False
|
2036
|
+
from_time: str, default = None
|
2037
|
+
Time to begin returning history
|
2038
|
+
to_time: str, default = None
|
2039
|
+
Time to end returning history
|
2040
|
+
for_lineage: bool, default is set by server
|
2041
|
+
- determines if elements classified as Memento should be returned - normally false
|
2042
|
+
for_duplicate_processing: bool, default is set by server
|
2043
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
2044
|
+
start_from: int, default = 0
|
2045
|
+
- index of the list to start from (0 for start).
|
2046
|
+
page_size
|
2047
|
+
- maximum number of elements to return.
|
2048
|
+
time_out: int, default = default_time_out
|
2049
|
+
- http request timeout for this request
|
2050
|
+
|
2051
|
+
Returns
|
2052
|
+
-------
|
2053
|
+
[dict] | str
|
2054
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
2055
|
+
|
2056
|
+
Raises
|
2057
|
+
------
|
2058
|
+
InvalidParameterException
|
2059
|
+
one of the parameters is null or invalid or
|
2060
|
+
PropertyServerException
|
2061
|
+
There is a problem adding the element properties to the metadata repository or
|
2062
|
+
UserNotAuthorizedException
|
2063
|
+
the requesting user is not authorized to issue this request.
|
2064
|
+
"""
|
2065
|
+
|
2066
|
+
loop = asyncio.get_event_loop()
|
2067
|
+
response = loop.run_until_complete(
|
2068
|
+
self._async_get_relationship_history(
|
2069
|
+
guid,
|
2070
|
+
effective_time,
|
2071
|
+
oldest_first,
|
2072
|
+
from_time,
|
2073
|
+
to_time,
|
2074
|
+
for_lineage,
|
2075
|
+
for_duplicate_processing,
|
2076
|
+
start_from,
|
2077
|
+
page_size,
|
2078
|
+
time_out,
|
2079
|
+
)
|
2080
|
+
)
|
2081
|
+
return response
|
2082
|
+
|
2083
|
+
|
2084
|
+
if __name__ == "__main__":
|
2085
|
+
print("Main-Metadata Explorer")
|