pyegeria 5.4.7.2__py3-none-any.whl → 5.4.7.4__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/dr_egeria_md.py +1 -1
- commands/cat/list_format_set.py +6 -1
- commands/ops/list_catalog_targets.py +17 -14
- commands/ops/monitor_engine_activity.py +1 -1
- commands/ops/monitor_engine_activity_c.py +1 -1
- commands/tech/list_gov_action_processes.py +4 -8
- md_processing/dr_egeria.py +1 -1
- md_processing/md_commands/ext_ref_commands.py +1 -2
- md_processing/md_commands/glossary_commands.py +1 -2
- md_processing/md_commands/project_commands.py +1 -2
- pyegeria/__init__.py +3 -95
- pyegeria/_client_new.py +422 -13
- pyegeria/_globals.py +95 -1
- pyegeria/_output_formats.py +1 -1
- pyegeria/asset_catalog_omvs.py +1 -1
- pyegeria/automated_curation.py +33 -92
- pyegeria/classification_manager.py +5636 -0
- pyegeria/classification_manager_omvs.py +1989 -1853
- pyegeria/collection_manager.py +16 -4
- pyegeria/data_designer.py +1 -2
- pyegeria/egeria_tech_client.py +3 -0
- pyegeria/external_references.py +2 -2
- pyegeria/format_set_executor.py +8 -9
- pyegeria/full_omag_server_config.py +1 -1
- pyegeria/glossary_manager.py +2 -2
- pyegeria/mcp_adapter.py +1 -1
- pyegeria/mcp_server.py +36 -21
- pyegeria/md_processing_utils.py +3 -3
- pyegeria/md_processing_utils_orig.py +3 -3
- pyegeria/mermaid_utilities.py +0 -152
- pyegeria/models.py +5 -0
- pyegeria/output_formatter.py +1 -1
- pyegeria/runtime_manager_omvs.py +1 -1
- pyegeria/solution_architect.py +1 -1
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/METADATA +1 -1
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/RECORD +40 -40
- pyegeria/md_processing_helpers.py +0 -58
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/WHEEL +0 -0
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/entry_points.txt +0 -0
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/licenses/LICENSE +0 -0
- {pyegeria-5.4.7.2.dist-info → pyegeria-5.4.7.4.dist-info}/top_level.txt +0 -0
pyegeria/_client_new.py
CHANGED
@@ -12,6 +12,7 @@ import inspect
|
|
12
12
|
import json
|
13
13
|
import os
|
14
14
|
import re
|
15
|
+
import sys
|
15
16
|
from collections.abc import Callable
|
16
17
|
from typing import Any
|
17
18
|
|
@@ -26,7 +27,7 @@ from pyegeria._exceptions_new import (
|
|
26
27
|
PyegeriaAPIException, PyegeriaConnectionException, PyegeriaInvalidParameterException,
|
27
28
|
PyegeriaUnknownException, PyegeriaClientException
|
28
29
|
)
|
29
|
-
from pyegeria._globals import enable_ssl_check, max_paging_size, NO_ELEMENTS_FOUND
|
30
|
+
from pyegeria._globals import enable_ssl_check, max_paging_size, NO_ELEMENTS_FOUND, default_time_out
|
30
31
|
from pyegeria._validators import (
|
31
32
|
validate_name,
|
32
33
|
validate_server_name,
|
@@ -34,9 +35,14 @@ from pyegeria._validators import (
|
|
34
35
|
validate_user_id,
|
35
36
|
)
|
36
37
|
from pyegeria.models import (SearchStringRequestBody, FilterRequestBody, GetRequestBody, NewElementRequestBody,
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
TemplateRequestBody, UpdateStatusRequestBody, UpdateElementRequestBody,
|
39
|
+
NewRelationshipRequestBody,
|
40
|
+
DeleteRequestBody, UpdateRelationshipRequestBody, ResultsRequestBody,
|
41
|
+
NewClassificationRequestBody,
|
42
|
+
DeleteElementRequestBody, DeleteRelationshipRequestBody, DeleteClassificationRequestBody,
|
43
|
+
LevelIdentifierQueryBody)
|
44
|
+
|
45
|
+
from pyegeria.output_formatter import populate_common_columns, resolve_output_formats, generate_output
|
40
46
|
from pyegeria.utils import body_slimmer, dynamic_catch
|
41
47
|
|
42
48
|
...
|
@@ -156,6 +162,27 @@ class Client2:
|
|
156
162
|
self._template_request_adapter = TypeAdapter(TemplateRequestBody)
|
157
163
|
self._update_relationship_request_adapter = TypeAdapter(UpdateRelationshipRequestBody)
|
158
164
|
self._results_request_adapter = TypeAdapter(ResultsRequestBody)
|
165
|
+
self._level_identifier_query_body = TypeAdapter(LevelIdentifierQueryBody)
|
166
|
+
|
167
|
+
try:
|
168
|
+
result = self.check_connection()
|
169
|
+
logger.info(f"client initialized, platform origin is: {result}")
|
170
|
+
except PyegeriaConnectionException as e:
|
171
|
+
raise
|
172
|
+
|
173
|
+
async def _async_check_connection(self) -> str:
|
174
|
+
"""Check if the connection is working"""
|
175
|
+
try:
|
176
|
+
response = await self.async_get_platform_origin()
|
177
|
+
return response
|
178
|
+
|
179
|
+
except PyegeriaConnectionException as e:
|
180
|
+
raise
|
181
|
+
def check_connection(self) -> str:
|
182
|
+
"""Check if the connection is working"""
|
183
|
+
loop = asyncio.get_event_loop()
|
184
|
+
response = loop.run_until_complete(self._async_check_connection())
|
185
|
+
return response
|
159
186
|
|
160
187
|
def __enter__(self):
|
161
188
|
return self
|
@@ -184,7 +211,7 @@ class Client2:
|
|
184
211
|
return
|
185
212
|
|
186
213
|
async def _async_create_egeria_bearer_token(
|
187
|
-
self, user_id: str
|
214
|
+
self, user_id: str , password: str
|
188
215
|
) -> str:
|
189
216
|
"""Create and set an Egeria Bearer Token for the user. Async version
|
190
217
|
Parameters
|
@@ -215,10 +242,8 @@ class Client2:
|
|
215
242
|
|
216
243
|
"""
|
217
244
|
if user_id is None:
|
218
|
-
validate_user_id(self.user_id)
|
219
245
|
user_id = self.user_id
|
220
246
|
if password is None:
|
221
|
-
validate_name(self.user_pwd)
|
222
247
|
password = self.user_pwd
|
223
248
|
|
224
249
|
url = f"{self.platform_url}/api/token"
|
@@ -365,13 +390,13 @@ class Client2:
|
|
365
390
|
"""Retrieve and return the bearer token"""
|
366
391
|
return self.text_headers["Authorization"]
|
367
392
|
|
368
|
-
def
|
393
|
+
async def async_get_platform_origin(self) -> str:
|
369
394
|
"""Return the platform origin string if reachable.
|
370
|
-
|
395
|
+
|
371
396
|
Historically this method returned a boolean; tests and helpers expect the actual origin text.
|
372
397
|
"""
|
373
398
|
origin_url = f"{self.platform_url}/open-metadata/platform-services/users/{self.user_id}/server-platform/origin"
|
374
|
-
response = self.
|
399
|
+
response = await self._async_make_request("GET", origin_url, is_json=False)
|
375
400
|
if response.status_code == 200:
|
376
401
|
text = response.text.strip()
|
377
402
|
logger.success(f"Got response from {origin_url}\n Response: {text}")
|
@@ -380,6 +405,16 @@ class Client2:
|
|
380
405
|
logger.info(f"Got response from {origin_url}\n status_code: {response.status_code}")
|
381
406
|
return ""
|
382
407
|
|
408
|
+
|
409
|
+
def get_platform_origin(self) -> str:
|
410
|
+
"""Return the platform origin string if reachable.
|
411
|
+
|
412
|
+
Historically this method returned a boolean; tests and helpers expect the actual origin text.
|
413
|
+
"""
|
414
|
+
loop = asyncio.get_event_loop()
|
415
|
+
response = loop.run_until_complete(self.async_get_platform_origin())
|
416
|
+
return response
|
417
|
+
|
383
418
|
# @logger.catch
|
384
419
|
def make_request(
|
385
420
|
self,
|
@@ -610,7 +645,7 @@ class Client2:
|
|
610
645
|
}
|
611
646
|
url = (
|
612
647
|
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
|
613
|
-
f"elements/guid-by-unique-name
|
648
|
+
f"elements/guid-by-unique-name"
|
614
649
|
)
|
615
650
|
|
616
651
|
result = await self._async_make_request("POST", url, body_slimmer(body))
|
@@ -662,6 +697,9 @@ class Client2:
|
|
662
697
|
f"qualified_name={qualified_name}, tech_type={tech_type}")
|
663
698
|
}
|
664
699
|
raise PyegeriaInvalidParameterException(None, None, additional_info)
|
700
|
+
#
|
701
|
+
# Include basic functions for finding elements and relationships.
|
702
|
+
#
|
665
703
|
|
666
704
|
def __get_guid__(
|
667
705
|
self,
|
@@ -705,7 +743,157 @@ class Client2:
|
|
705
743
|
q_name = f"{q_name}::{version_identifier}"
|
706
744
|
return q_name
|
707
745
|
|
708
|
-
async def
|
746
|
+
async def _async_get_relationships_with_property_value(
|
747
|
+
self,
|
748
|
+
relationship_type: str,
|
749
|
+
property_value: str,
|
750
|
+
property_names: [str],
|
751
|
+
effective_time: str = None,
|
752
|
+
for_lineage: bool = None,
|
753
|
+
for_duplicate_processing: bool = None,
|
754
|
+
start_from: int = 0,
|
755
|
+
page_size: int = max_paging_size,
|
756
|
+
time_out: int = default_time_out,
|
757
|
+
) -> list | str:
|
758
|
+
"""
|
759
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in
|
760
|
+
one of the relationship's properties specified. The value must match exactly. Async version.
|
761
|
+
|
762
|
+
https://egeria-project.org/types/
|
763
|
+
|
764
|
+
Parameters
|
765
|
+
----------
|
766
|
+
relationship_type: str
|
767
|
+
- the type of relationship to navigate to related elements
|
768
|
+
property_value: str
|
769
|
+
- property value to be searched.
|
770
|
+
property_names: [str]
|
771
|
+
- property names to search in.
|
772
|
+
effective_time: str, default = None
|
773
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
774
|
+
for_lineage: bool, default is set by server
|
775
|
+
- determines if elements classified as Memento should be returned - normally false
|
776
|
+
for_duplicate_processing: bool, default is set by server
|
777
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
778
|
+
start_from: int, default = 0
|
779
|
+
- index of the list to start from (0 for start).
|
780
|
+
page_size
|
781
|
+
- maximum number of elements to return.
|
782
|
+
|
783
|
+
|
784
|
+
time_out: int, default = default_time_out
|
785
|
+
- http request timeout for this request
|
786
|
+
|
787
|
+
Returns
|
788
|
+
-------
|
789
|
+
[dict] | str
|
790
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
791
|
+
|
792
|
+
Raises
|
793
|
+
------
|
794
|
+
InvalidParameterException
|
795
|
+
one of the parameters is null or invalid or
|
796
|
+
PropertyServerException
|
797
|
+
There is a problem adding the element properties to the metadata repository or
|
798
|
+
UserNotAuthorizedException
|
799
|
+
the requesting user is not authorized to issue this request.
|
800
|
+
"""
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
body = {
|
805
|
+
"class": "FindPropertyNamesProperties",
|
806
|
+
"openMetadataType": relationship_type,
|
807
|
+
"propertyValue": property_value,
|
808
|
+
"propertyNames": property_names,
|
809
|
+
"effectiveTime": effective_time,
|
810
|
+
}
|
811
|
+
|
812
|
+
url = (
|
813
|
+
f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/classification-manager/relationships/"
|
814
|
+
f"with-exact-property-value"
|
815
|
+
)
|
816
|
+
|
817
|
+
response: Response = await self._async_make_request(
|
818
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
819
|
+
)
|
820
|
+
rels = response.json().get("relationships", NO_ELEMENTS_FOUND)
|
821
|
+
if type(rels) is list:
|
822
|
+
if len(rels) == 0:
|
823
|
+
return NO_ELEMENTS_FOUND
|
824
|
+
return rels
|
825
|
+
|
826
|
+
def get_relationships_with_property_value(
|
827
|
+
self,
|
828
|
+
relationship_type: str,
|
829
|
+
property_value: str,
|
830
|
+
property_names: [str],
|
831
|
+
effective_time: str = None,
|
832
|
+
for_lineage: bool = None,
|
833
|
+
for_duplicate_processing: bool = None,
|
834
|
+
start_from: int = 0,
|
835
|
+
page_size: int = max_paging_size,
|
836
|
+
time_out: int = default_time_out,
|
837
|
+
) -> list | str:
|
838
|
+
"""
|
839
|
+
Retrieve relationships of the requested relationship type name and with the requested a value found in
|
840
|
+
one of the relationship's properties specified. The value must match exactly.
|
841
|
+
|
842
|
+
Parameters
|
843
|
+
----------
|
844
|
+
relationship_type: str
|
845
|
+
- the type of relationship to navigate to related elements
|
846
|
+
property_value: str
|
847
|
+
- property value to be searched.
|
848
|
+
property_names: [str]
|
849
|
+
- property names to search in.
|
850
|
+
effective_time: str, default = None
|
851
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
852
|
+
for_lineage: bool, default is set by server
|
853
|
+
- determines if elements classified as Memento should be returned - normally false
|
854
|
+
for_duplicate_processing: bool, default is set by server
|
855
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
856
|
+
start_from: int, default = 0
|
857
|
+
- index of the list to start from (0 for start).
|
858
|
+
page_size
|
859
|
+
- maximum number of elements to return.
|
860
|
+
|
861
|
+
|
862
|
+
time_out: int, default = default_time_out
|
863
|
+
- http request timeout for this request
|
864
|
+
|
865
|
+
Returns
|
866
|
+
-------
|
867
|
+
[dict] | str
|
868
|
+
Returns a string if no elements found and a list of dict of elements with the results.
|
869
|
+
|
870
|
+
Raises
|
871
|
+
------
|
872
|
+
InvalidParameterException
|
873
|
+
one of the parameters is null or invalid or
|
874
|
+
PropertyServerException
|
875
|
+
There is a problem adding the element properties to the metadata repository or
|
876
|
+
UserNotAuthorizedException
|
877
|
+
the requesting user is not authorized to issue this request.
|
878
|
+
"""
|
879
|
+
|
880
|
+
loop = asyncio.get_event_loop()
|
881
|
+
response = loop.run_until_complete(
|
882
|
+
self._async_get_relationships_with_property_value(
|
883
|
+
relationship_type,
|
884
|
+
property_value,
|
885
|
+
property_names,
|
886
|
+
effective_time,
|
887
|
+
for_lineage,
|
888
|
+
for_duplicate_processing,
|
889
|
+
start_from,
|
890
|
+
page_size,
|
891
|
+
time_out,
|
892
|
+
)
|
893
|
+
)
|
894
|
+
return response
|
895
|
+
|
896
|
+
async def async_get_element_by_guid_(self, element_guid: str) -> dict | str:
|
709
897
|
"""
|
710
898
|
Simplified, internal version of get_element_by_guid found in Classification Manager.
|
711
899
|
Retrieve an element by its guid. Async version.
|
@@ -744,6 +932,169 @@ class Client2:
|
|
744
932
|
|
745
933
|
return elements
|
746
934
|
|
935
|
+
|
936
|
+
async def async_get_connector_guid(self, connector_name: str) -> str:
|
937
|
+
"""Get the guid of a connector. Async version.
|
938
|
+
Parameters:
|
939
|
+
connector_name (str): The name of the connector to retrieve the guid for.
|
940
|
+
Returns:
|
941
|
+
str: The guid of the connector.
|
942
|
+
"""
|
943
|
+
rel = await self.async_get_relationships_with_property_value(relationship_type="RegisteredIntegrationConnector",
|
944
|
+
property_names=["connectorName"],
|
945
|
+
property_value=connector_name,
|
946
|
+
)
|
947
|
+
if rel == "No elements found":
|
948
|
+
logger.error(f"\n\n===> No connector found with name '{connector_name}'\n\n")
|
949
|
+
return "No connector found"
|
950
|
+
connector_guid = rel[0]['end2']['guid']
|
951
|
+
|
952
|
+
if connector_guid is None:
|
953
|
+
logger.error(f"\n\n===> No connector found with name '{connector_name}'\n\n")
|
954
|
+
return "No connector found"
|
955
|
+
|
956
|
+
return connector_guid
|
957
|
+
|
958
|
+
|
959
|
+
def get_connector_guid(self, connector_name: str) -> str:
|
960
|
+
"""Get the guid of a connector.
|
961
|
+
Parameters:
|
962
|
+
connector_name (str): The name of the connector to retrieve the guid for.
|
963
|
+
Returns:
|
964
|
+
str: The guid of the connector.
|
965
|
+
"""
|
966
|
+
|
967
|
+
loop = asyncio.get_event_loop()
|
968
|
+
result = loop.run_until_complete(
|
969
|
+
self.async_get_connector_guid(
|
970
|
+
connector_name
|
971
|
+
)
|
972
|
+
)
|
973
|
+
return result
|
974
|
+
|
975
|
+
# async def async_get_catalog_template_guids(
|
976
|
+
# self,
|
977
|
+
# element_name: str
|
978
|
+
# ) -> lists | str:
|
979
|
+
# """
|
980
|
+
# Retrieve template guids for an element.
|
981
|
+
# Parameters
|
982
|
+
# ----------
|
983
|
+
# element_name: str
|
984
|
+
# - unique identifier for the element to retrieve the guids for.
|
985
|
+
#
|
986
|
+
# Returns
|
987
|
+
# -------
|
988
|
+
# [str]] | str
|
989
|
+
# Returns a string if no elements found and a list of dict of elements with the results.
|
990
|
+
#
|
991
|
+
# Raises
|
992
|
+
# ------
|
993
|
+
# InvalidParameterException
|
994
|
+
# one of the parameters is null or invalid or
|
995
|
+
# PropertyServerException
|
996
|
+
# There is a problem adding the element properties to the metadata repository or
|
997
|
+
# UserNotAuthorizedException
|
998
|
+
# the requesting user is not authorized to issue this request.
|
999
|
+
# """
|
1000
|
+
#
|
1001
|
+
# body = {
|
1002
|
+
# "class": "FindPropertyNamesProperties",
|
1003
|
+
# "openMetadataType": relationship_type,
|
1004
|
+
# "propertyValue": property_value,
|
1005
|
+
# "propertyNames": property_names,
|
1006
|
+
# "effectiveTime": effective_time,
|
1007
|
+
# }
|
1008
|
+
#
|
1009
|
+
# url = (
|
1010
|
+
# f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/classification-manager/relationships/"
|
1011
|
+
# f"with-exact-property-value"
|
1012
|
+
# )
|
1013
|
+
#
|
1014
|
+
# response: Response = await self._async_make_request(
|
1015
|
+
# "POST", url, body_slimmer(body), time_out=time_out
|
1016
|
+
# )
|
1017
|
+
# rels = response.json().get("relationships", NO_ELEMENTS_FOUND)
|
1018
|
+
# if type(rels) is list:
|
1019
|
+
# if len(rels) == 0:
|
1020
|
+
# return NO_ELEMENTS_FOUND
|
1021
|
+
# return rels
|
1022
|
+
#
|
1023
|
+
# def get_relationships_with_property_value(
|
1024
|
+
# self,
|
1025
|
+
# relationship_type: str,
|
1026
|
+
# property_value: str,
|
1027
|
+
# property_names: [str],
|
1028
|
+
# effective_time: str = None,
|
1029
|
+
# for_lineage: bool = None,
|
1030
|
+
# for_duplicate_processing: bool = None,
|
1031
|
+
# start_from: int = 0,
|
1032
|
+
# page_size: int = max_paging_size,
|
1033
|
+
# time_out: int = default_time_out,
|
1034
|
+
# ) -> list | str:
|
1035
|
+
# """
|
1036
|
+
# Retrieve relationships of the requested relationship type name and with the requested a value found in
|
1037
|
+
# one of the relationship's properties specified. The value must match exactly.
|
1038
|
+
#
|
1039
|
+
# Parameters
|
1040
|
+
# ----------
|
1041
|
+
# relationship_type: str
|
1042
|
+
# - the type of relationship to navigate to related elements
|
1043
|
+
# property_value: str
|
1044
|
+
# - property value to be searched.
|
1045
|
+
# property_names: [str]
|
1046
|
+
# - property names to search in.
|
1047
|
+
# effective_time: str, default = None
|
1048
|
+
# - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1049
|
+
# for_lineage: bool, default is set by server
|
1050
|
+
# - determines if elements classified as Memento should be returned - normally false
|
1051
|
+
# for_duplicate_processing: bool, default is set by server
|
1052
|
+
# - Normally false. Set true when the caller is part of a deduplication function
|
1053
|
+
# start_from: int, default = 0
|
1054
|
+
# - index of the list to start from (0 for start).
|
1055
|
+
# page_size
|
1056
|
+
# - maximum number of elements to return.
|
1057
|
+
#
|
1058
|
+
#
|
1059
|
+
# time_out: int, default = default_time_out
|
1060
|
+
# - http request timeout for this request
|
1061
|
+
#
|
1062
|
+
# Returns
|
1063
|
+
# -------
|
1064
|
+
# [dict] | str
|
1065
|
+
# Returns a string if no elements found and a list of dict of elements with the results.
|
1066
|
+
#
|
1067
|
+
# Raises
|
1068
|
+
# ------
|
1069
|
+
# InvalidParameterException
|
1070
|
+
# one of the parameters is null or invalid or
|
1071
|
+
# PropertyServerException
|
1072
|
+
# There is a problem adding the element properties to the metadata repository or
|
1073
|
+
# UserNotAuthorizedException
|
1074
|
+
# the requesting user is not authorized to issue this request.
|
1075
|
+
# """
|
1076
|
+
#
|
1077
|
+
# loop = asyncio.get_event_loop()
|
1078
|
+
# response = loop.run_until_complete(
|
1079
|
+
# self._async_get_relationships_with_property_value(
|
1080
|
+
# relationship_type,
|
1081
|
+
# property_value,
|
1082
|
+
# property_names,
|
1083
|
+
# effective_time,
|
1084
|
+
# for_lineage,
|
1085
|
+
# for_duplicate_processing,
|
1086
|
+
# start_from,
|
1087
|
+
# page_size,
|
1088
|
+
# time_out,
|
1089
|
+
# )
|
1090
|
+
# )
|
1091
|
+
# return response
|
1092
|
+
|
1093
|
+
#
|
1094
|
+
# Helper functions for requests
|
1095
|
+
#
|
1096
|
+
|
1097
|
+
|
747
1098
|
def validate_new_element_request(self, body: dict | NewElementRequestBody,
|
748
1099
|
prop: list[str]) -> NewElementRequestBody | None:
|
749
1100
|
if isinstance(body, NewElementRequestBody):
|
@@ -1072,6 +1423,35 @@ class Client2:
|
|
1072
1423
|
output_format, output_format_set)
|
1073
1424
|
return elements
|
1074
1425
|
|
1426
|
+
async def _async_get_level_identifier_query_body_request(self, url: str, _gen_output: Callable[..., Any],
|
1427
|
+
output_format: str = 'JSON',
|
1428
|
+
output_format_set: str | dict = None,
|
1429
|
+
body: dict | ResultsRequestBody = None) -> Any:
|
1430
|
+
if isinstance(body, LevelIdentifierQueryBody):
|
1431
|
+
validated_body = body
|
1432
|
+
elif isinstance(body, dict):
|
1433
|
+
validated_body = self._level_identifier_query_body.validate_python(body)
|
1434
|
+
else:
|
1435
|
+
return None
|
1436
|
+
|
1437
|
+
json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
|
1438
|
+
|
1439
|
+
response = await self._async_make_request("POST", url, json_body)
|
1440
|
+
elements = response.json().get("elements", None)
|
1441
|
+
if elements is None:
|
1442
|
+
elements = response.json().get("element", NO_ELEMENTS_FOUND)
|
1443
|
+
|
1444
|
+
if type(elements) is str:
|
1445
|
+
logger.info(NO_ELEMENTS_FOUND)
|
1446
|
+
return NO_ELEMENTS_FOUND
|
1447
|
+
|
1448
|
+
if output_format != 'JSON': # return a simplified markdown representation
|
1449
|
+
logger.info(f"Found elements, output format: {output_format} and output_format_set: {output_format_set}")
|
1450
|
+
return _gen_output(elements, "", "Referenceable",
|
1451
|
+
output_format, output_format_set)
|
1452
|
+
return elements
|
1453
|
+
|
1454
|
+
|
1075
1455
|
async def _async_create_element_body_request(self, url: str, prop: list[str],
|
1076
1456
|
body: dict | NewElementRequestBody = None) -> str:
|
1077
1457
|
validated_body = self.validate_new_element_request(body, prop)
|
@@ -1604,4 +1984,33 @@ class Client2:
|
|
1604
1984
|
# }
|
1605
1985
|
# """
|
1606
1986
|
# loop = asyncio.get_event_loop()
|
1607
|
-
# loop.run_until_complete(self._async_update_element_status(guid, status, body))
|
1987
|
+
# loop.run_until_complete(self._async_update_element_status(guid, status, body))
|
1988
|
+
|
1989
|
+
@dynamic_catch
|
1990
|
+
def _extract_referenceable_properties(self, element: dict, columns_struct: dict) -> dict:
|
1991
|
+
"""Populate default Referenceable columns for output using common population pipeline."""
|
1992
|
+
return populate_common_columns(element, columns_struct)
|
1993
|
+
|
1994
|
+
@dynamic_catch
|
1995
|
+
def _generate_referenceable_output(self, elements: dict | list[dict], search_string: str | None,
|
1996
|
+
element_type_name: str | None,
|
1997
|
+
output_format: str = "JSON",
|
1998
|
+
output_format_set: dict | str = None) -> str | list[dict]:
|
1999
|
+
"""Generate formatted output for generic Referenceable elements.
|
2000
|
+
|
2001
|
+
If output_format is 'JSON', returns elements unchanged. Otherwise, resolves an
|
2002
|
+
output format set and delegates to generate_output with a standard extractor.
|
2003
|
+
"""
|
2004
|
+
if output_format == "JSON":
|
2005
|
+
return elements
|
2006
|
+
entity_type = element_type_name or "Referenceable"
|
2007
|
+
output_formats = resolve_output_formats(entity_type, output_format, output_format_set, default_label=entity_type)
|
2008
|
+
return generate_output(
|
2009
|
+
elements=elements,
|
2010
|
+
search_string=search_string,
|
2011
|
+
entity_type=entity_type,
|
2012
|
+
output_format=output_format,
|
2013
|
+
extract_properties_func=self._extract_referenceable_properties,
|
2014
|
+
get_additional_props_func=None,
|
2015
|
+
columns_struct=output_formats,
|
2016
|
+
)
|
pyegeria/_globals.py
CHANGED
@@ -46,4 +46,98 @@ NO_ELEMENT_FOUND = "No element found"
|
|
46
46
|
NO_PROJECTS_FOUND = "No projects found"
|
47
47
|
NO_COLLECTION_FOUND = "No collection found"
|
48
48
|
NO_GUID_RETURNED = "No guid returned"
|
49
|
-
NO_MEMBERS_FOUND = "No members found"
|
49
|
+
NO_MEMBERS_FOUND = "No members found"
|
50
|
+
|
51
|
+
#
|
52
|
+
TEMPLATE_GUIDS['File System Directory'] = 'c353fd5d-9523-4a5e-a5e2-723ae490fe54'
|
53
|
+
INTEGRATION_GUIDS['GeneralFilesMonitor'] = '1b98cdac-dd0a-4621-93db-99ef5a1098bc'
|
54
|
+
INTEGRATION_GUIDS['OpenLineageFilePublisher'] = '6271b678-7d22-4cdf-87b1-45b366beaf4e'
|
55
|
+
INTEGRATION_GUIDS['ContentPacksMonitor'] = '6bb2181e-7724-4515-ba3c-877cded55980'
|
56
|
+
INTEGRATION_GUIDS['HarvestActivity'] = '856501d9-ec29-4e67-9cd7-120f53710ffa'
|
57
|
+
INTEGRATION_GUIDS['SampleDataFilesMonitor'] = 'cd6479e1-2fe7-4426-b358-8a0cf70be117'
|
58
|
+
TEMPLATE_GUIDS['CSV Data File'] = '13770f93-13c8-42be-9bb8-e0b1b1e52b1f'
|
59
|
+
TEMPLATE_GUIDS['Keystore File'] = 'fbcfcc0c-1652-421f-b49b-c3e1c108768f'
|
60
|
+
TEMPLATE_GUIDS['Unity Catalog Registered Model Version'] = '1364bfe7-8295-4e99-9243-8840aeac4cf1'
|
61
|
+
TEMPLATE_GUIDS['Unity Catalog Server'] = 'dcca9788-b30f-4007-b1ac-ec634aff6879'
|
62
|
+
INTEGRATION_GUIDS['UnityCatalogInsideCatalog'] = '74dde22f-2249-4ea3-af2b-b39e73f79b81'
|
63
|
+
INTEGRATION_GUIDS['UnityCatalogServer'] = '06d068d9-9e08-4e67-8c59-073bbf1013af'
|
64
|
+
TEMPLATE_GUIDS['Databricks Unity Catalog Server'] = '3f7f62f6-4abc-424e-9f92-523306e7d5d5'
|
65
|
+
INTEGRATION_GUIDS['JDBC'] = '70dcd0b7-9f06-48ad-ad44-ae4d7a7762aa'
|
66
|
+
TEMPLATE_GUIDS['Data File'] = '66d8dda9-00cf-4e59-938c-4b0583596b1e'
|
67
|
+
TEMPLATE_GUIDS['Unity Catalog Catalog'] = '5ee006aa-a6d6-411b-9b8d-5f720c079cae'
|
68
|
+
TEMPLATE_GUIDS['View Server'] = 'fd61ca01-390d-4aa2-a55d-426826aa4e1b'
|
69
|
+
TEMPLATE_GUIDS['Archive File'] = '7578e504-d00f-406d-a194-3fc0a351cdf9'
|
70
|
+
TEMPLATE_GUIDS['Executable File'] = '3d99a163-7a13-4576-a212-784010a8302a'
|
71
|
+
INTEGRATION_GUIDS['OpenLineageAPIPublisher'] = '2156bc98-973a-4859-908d-4ccc96f53cc5'
|
72
|
+
TEMPLATE_GUIDS['PostgreSQL Relational Database'] = '3d398b3f-7ae6-4713-952a-409f3dea8520'
|
73
|
+
INTEGRATION_GUIDS['PostgreSQLDatabase'] = 'ef301220-7dfe-4c6c-bb9d-8f92d9f63823'
|
74
|
+
TEMPLATE_GUIDS['Unity Catalog Table'] = '6cc1e5f5-4c1e-4290-a80e-e06643ffb13d'
|
75
|
+
TEMPLATE_GUIDS['JSON Data File'] = 'c4836635-7e9e-446a-83b5-15e206b1aff3'
|
76
|
+
TEMPLATE_GUIDS['File System'] = '522f228c-097c-4f90-9efc-26c1f2696f87'
|
77
|
+
TEMPLATE_GUIDS['Source Code File'] = '9c7013ef-f29b-4b01-a8ea-5ea14f64c67a'
|
78
|
+
TEMPLATE_GUIDS['Program File'] = '32d27e9c-1fdf-455a-ad2a-42b4d7d99108'
|
79
|
+
TEMPLATE_GUIDS['Apple MacBook Pro'] = '32a9fd56-85c9-47fe-a211-9da3871bf4da'
|
80
|
+
TEMPLATE_GUIDS['Build Instruction File'] = 'fbb2fa2e-8bcb-402e-9be7-5c6db9f2c504'
|
81
|
+
TEMPLATE_GUIDS['Spreadsheet Data File'] = 'e4fabff5-2ba9-4050-9076-6ed917970b4c'
|
82
|
+
TEMPLATE_GUIDS['UNIX File System'] = '27117270-8667-41d0-a99a-9118f9b60199'
|
83
|
+
TEMPLATE_GUIDS['Video Data File'] = '93b2b722-ec0f-4da4-960a-b8d4922f8bf5'
|
84
|
+
TEMPLATE_GUIDS['JDBC Endpoint'] = '3d79ce50-1887-4627-ad71-ba4649aba2bc'
|
85
|
+
TEMPLATE_GUIDS['Unity Catalog Function'] = 'a490ba65-6104-4213-9be9-524e16fed8aa'
|
86
|
+
TEMPLATE_GUIDS['Unity Catalog Registered Model'] = '0d762ec5-c1f5-4364-aa64-e7e00d27f837'
|
87
|
+
TEMPLATE_GUIDS['PostgreSQL Relational Database Schema'] = '82a5417c-d882-4271-8444-4c6a996a8bfc'
|
88
|
+
INTEGRATION_GUIDS['HarvestSurveys'] = 'fae162c3-2bfd-467f-9c47-2e3b63a655de'
|
89
|
+
INTEGRATION_GUIDS['HarvestActivity'] = '856501d9-ec29-4e67-9cd7-120f53710ffa'
|
90
|
+
INTEGRATION_GUIDS['HarvestOpenMetadata'] = 'f8bf326b-d613-4ece-a12e-a1423bc272d7'
|
91
|
+
TEMPLATE_GUIDS['PostgreSQL Server'] = '542134e6-b9ce-4dce-8aef-22e8daf34fdb'
|
92
|
+
INTEGRATION_GUIDS['PostgreSQLServer'] = '36f69fd0-54ba-4f59-8a44-11ccf2687a34'
|
93
|
+
TEMPLATE_GUIDS['Audio Data File'] = '39b4b670-7f15-4744-a5ba-62e8edafbcee'
|
94
|
+
TEMPLATE_GUIDS['Document File'] = 'eb6f728d-fa54-4350-9807-1199cbf96851'
|
95
|
+
TEMPLATE_GUIDS['Engine Host'] = '1764a891-4234-45f1-8cc3-536af40c790d'
|
96
|
+
TEMPLATE_GUIDS['Integration Daemon'] = '6b3516f0-dd13-4786-9601-07215f995197'
|
97
|
+
TEMPLATE_GUIDS['XML Data File'] = 'ea67ae71-c674-473e-b38b-689879d2a7d9'
|
98
|
+
TEMPLATE_GUIDS['Avro Data File'] = '9f5be428-058e-41dd-b506-3a222283b579'
|
99
|
+
TEMPLATE_GUIDS['REST API Endpoint'] = '9ea4bff4-d193-492f-bcad-6e68c07c6f9e'
|
100
|
+
TEMPLATE_GUIDS['Unity Catalog Schema'] = '5bf92b0f-3970-41ea-b0a3-aacfbf6fd92e'
|
101
|
+
TEMPLATE_GUIDS['Unity Catalog Volume'] = '92d2d2dc-0798-41f0-9512-b10548d312b7'
|
102
|
+
TEMPLATE_GUIDS['Parquet Data File'] = '7f6cd744-79c3-4d25-a056-eeb1a91574c3'
|
103
|
+
TEMPLATE_GUIDS['File'] = 'ae3067c7-cc72-4a18-88e1-746803c2c86f'
|
104
|
+
TEMPLATE_GUIDS['3D Image Data File'] = '0059ea2b-6292-4cac-aa6f-a80a605f1114'
|
105
|
+
TEMPLATE_GUIDS['YAML File'] = '2221855b-2b64-4b45-a2ee-c40adc5e2a64'
|
106
|
+
TEMPLATE_GUIDS['Apache Kafka Topic'] = 'ea8f81c9-c59c-47de-9525-7cc59d1251e5'
|
107
|
+
INTEGRATION_GUIDS['OpenLineageKafkaListener'] = '980b989c-de78-4e6a-a58d-51049d7381bf'
|
108
|
+
TEMPLATE_GUIDS['Script File'] = 'dbd5e6bb-1ff8-46f4-a007-fb0485f68c92'
|
109
|
+
TEMPLATE_GUIDS['Apache Atlas Server'] = 'fe6dce45-a978-4417-ab55-17f05b8bcea7'
|
110
|
+
INTEGRATION_GUIDS['ApacheAtlasServer'] = '5721627a-2dd4-4f95-a274-6cfb128edb97'
|
111
|
+
TEMPLATE_GUIDS['Raster Data File'] = '47211156-f03f-4881-8526-015e695a3dac'
|
112
|
+
TEMPLATE_GUIDS['Metadata Access Server'] = 'bd8de890-fa79-4c24-aab8-20b41b5893dd'
|
113
|
+
TEMPLATE_GUIDS['Data Folder'] = '372a0379-7060-4c9d-8d84-bc709b31794c'
|
114
|
+
INTEGRATION_GUIDS['MaintainDataFolderLastUpdateDate'] = 'fd26f07c-ae44-4bc5-b457-37b43112224f'
|
115
|
+
INTEGRATION_GUIDS['OpenLineageFilePublisher'] = '6271b678-7d22-4cdf-87b1-45b366beaf4e'
|
116
|
+
TEMPLATE_GUIDS['Properties File'] = '3b281111-a0ef-4fc4-99e7-9a0ef84a7636'
|
117
|
+
TEMPLATE_GUIDS['Vector Data File'] = 'db1bec7f-55a9-40d3-91c0-a57b76d422e2'
|
118
|
+
TEMPLATE_GUIDS['OMAG Server Platform'] = '9b06c4dc-ddc8-47ae-b56b-28775d3a96f0'
|
119
|
+
INTEGRATION_GUIDS['OpenAPI'] = 'b89d9a5a-2ea6-49bc-a4fc-e7df9f3ca93e'
|
120
|
+
INTEGRATION_GUIDS['OMAGServerPlatform'] = 'dee84e6e-7a96-4975-86c1-152fb3ab759b'
|
121
|
+
TEMPLATE_GUIDS['Apache Kafka Server'] = '5e1ff810-5418-43f7-b7c4-e6e062f9aff7'
|
122
|
+
INTEGRATION_GUIDS['KafkaTopic'] = 'fa1f711c-0b34-4b57-8e6e-16162b132b0c'
|
123
|
+
INTEGRATION_GUIDS['OpenLineageAPIPublisher'] = '2156bc98-973a-4859-908d-4ccc96f53cc5'
|
124
|
+
INTEGRATION_GUIDS['JDBCDatabaseCataloguer'] = '70dcd0b7-9f06-48ad-ad44-ae4d7a7762aa'
|
125
|
+
INTEGRATION_GUIDS['ApacheKafkaCataloguer'] = 'fa1f711c-0b34-4b57-8e6e-16162b132b0c'
|
126
|
+
INTEGRATION_GUIDS['FilesCataloguer'] = '1b98cdac-dd0a-4621-93db-99ef5a1098bc'
|
127
|
+
INTEGRATION_GUIDS['UnityCatalogServerSynchronizer'] = '06d068d9-9e08-4e67-8c59-073bbf1013af'
|
128
|
+
INTEGRATION_GUIDS['SampleDataCataloguer'] = 'cd6479e1-2fe7-4426-b358-8a0cf70be117'
|
129
|
+
INTEGRATION_GUIDS['OpenLineageGovernanceActionPublisher'] = '206f8faf-04da-4b6f-8280-eeee3943afeb'
|
130
|
+
INTEGRATION_GUIDS['OMAGServerPlatformCataloguer'] = 'dee84e6e-7a96-4975-86c1-152fb3ab759b'
|
131
|
+
INTEGRATION_GUIDS['HarvestActivity'] = '856501d9-ec29-4e67-9cd7-120f53710ffa'
|
132
|
+
INTEGRATION_GUIDS['MaintainLastUpdateDate'] = 'fd26f07c-ae44-4bc5-b457-37b43112224f'
|
133
|
+
INTEGRATION_GUIDS['UnityCatalogInsideCatalogSynchronizer'] = '74dde22f-2249-4ea3-af2b-b39e73f79b81'
|
134
|
+
INTEGRATION_GUIDS['OpenLineageKafkaListener'] = '980b989c-de78-4e6a-a58d-51049d7381bf'
|
135
|
+
INTEGRATION_GUIDS['HarvestOpenMetadata'] = 'f8bf326b-d613-4ece-a12e-a1423bc272d7'
|
136
|
+
INTEGRATION_GUIDS['OpenAPICataloguer'] = 'b89d9a5a-2ea6-49bc-a4fc-e7df9f3ca93e'
|
137
|
+
INTEGRATION_GUIDS['OpenLineageFilePublisher'] = '6271b678-7d22-4cdf-87b1-45b366beaf4e'
|
138
|
+
INTEGRATION_GUIDS['PostgreSQLServerCataloguer'] = '36f69fd0-54ba-4f59-8a44-11ccf2687a34'
|
139
|
+
INTEGRATION_GUIDS['PostgreSQLDatabaseCataloguer'] = 'ef301220-7dfe-4c6c-bb9d-8f92d9f63823'
|
140
|
+
INTEGRATION_GUIDS['ContentPacksCataloguer'] = '6bb2181e-7724-4515-ba3c-877cded55980'
|
141
|
+
INTEGRATION_GUIDS['OpenLineageCataloguer'] = '3347ac71-8dd2-403a-bc16-75a71be64bd7'
|
142
|
+
INTEGRATION_GUIDS['ApacheAtlasExchange'] = '5721627a-2dd4-4f95-a274-6cfb128edb97'
|
143
|
+
INTEGRATION_GUIDS['HarvestSurveys'] = 'fae162c3-2bfd-467f-9c47-2e3b63a655de'
|
pyegeria/_output_formats.py
CHANGED
@@ -117,7 +117,7 @@ OPTIONAL_PARAMS = ["page_size", "start_from", "starts_with", "ends_with", "ignor
|
|
117
117
|
# Define shared elements
|
118
118
|
COMMON_COLUMNS = [
|
119
119
|
Column(name='Display Name', key='display_name'),
|
120
|
-
Column(name='Qualified Name', key='qualified_name', format=
|
120
|
+
Column(name='Qualified Name', key='qualified_name', format=False),
|
121
121
|
Column(name='Category', key='category'),
|
122
122
|
Column(name='Description', key='description', format=True),
|
123
123
|
Column(name='Status', key='status'),
|
pyegeria/asset_catalog_omvs.py
CHANGED
@@ -15,7 +15,7 @@ import json
|
|
15
15
|
from httpx import Response
|
16
16
|
from pyegeria.utils import body_slimmer
|
17
17
|
from pyegeria._client import Client
|
18
|
-
from pyegeria import TEMPLATE_GUIDS, max_paging_size
|
18
|
+
from pyegeria._globals import TEMPLATE_GUIDS, max_paging_size
|
19
19
|
from pyegeria._exceptions import InvalidParameterException
|
20
20
|
from pyegeria._globals import NO_ELEMENTS_FOUND, NO_ASSETS_FOUND
|
21
21
|
from ._validators import validate_search_string
|