diff --git a/examples/widgets/catalog_user/view_asset_graph.py b/examples/widgets/catalog_user/view_asset_graph.py index b3fc0b1..42a3a48 100644 --- a/examples/widgets/catalog_user/view_asset_graph.py +++ b/examples/widgets/catalog_user/view_asset_graph.py @@ -40,7 +40,7 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str): - def build_classifications(classification: dict) -> Markdown: + def build_classifications(classification: dict) -> str: class_md = "" for c in classification: @@ -49,7 +49,7 @@ def build_classifications(classification: dict) -> Markdown: continue class_md += f"* Classification: {c_type}\n" class_props = c.get("classificationProperties","---") - if type(class_props) is list: + if type(class_props) is dict: for prop in class_props.keys(): class_md += f"\t* {prop}: {class_props[prop]}\n" if class_md == "": @@ -125,7 +125,6 @@ def build_nested_elements(nested_element: dict) -> Markdown: asset_relationships = asset_graph["relationships"] asset_class_md = build_classifications(asset_classifications) - asset_properties = asset_graph["extendedProperties"] prop_md = "\n* Extended Properties:\n" for prop in asset_properties: @@ -190,24 +189,24 @@ def build_nested_elements(nested_element: dict) -> Markdown: f"* Created by: {relationship_created_by} at time {relationship_creation_time}\n" ) rel_end1_md = ( - f"* End1:\n" - f"\t* Type: {rel_end1_type}\n" + f"\n**End1:**\n" + f"\n\t* Type: {rel_end1_type}\n" f"\t* GUID: {rel_end1_guid}\n" f"\t* Unique Name: {rel_end1_unique_name}\n" ) if rel_end1_class_md is not None: - rel_end1_md = rel_end1_class_md + rel_end1_md + rel_end1_md = rel_end1_md + rel_end1_class_md rel_end2_md = ( - f"* End2:\n" - f"\t* Type: {rel_end2_type}\n" + f"\n**End2:**\n" + f"\n\t* Type: {rel_end2_type}\n" f"\t* GUID: {rel_end2_guid}\n" f"\t* Unique Name: {rel_end2_unique_name}\n" ) if rel_end2_class_md is not None: - rel_end1_md = rel_end2_class_md + rel_end1_md + rel_end1_md = rel_end1_md + rel_end2_class_md # # for prop in relationship_properties.keys(): # relationship_md += f"* {prop}: {relationship_properties[prop]}\n" diff --git a/pyproject.toml b/pyproject.toml index eb1c2d7..f8e8869 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyegeria" -version = "0.4.0" +version = "0.4.1" #license = 'Apache 2.0' authors = [ {name ="Dan Wolfson", email= "dan.wolfson@pdr-associates.com"}, @@ -34,6 +34,12 @@ classifiers = [ "Programming Language :: Python :: 3", ] +#[project.scripts] +# view_server_status = "examples.widgets.operational.view_server_status:main" +# view_my_todos = "examples.widgets.personal_organizer.view_my_todos:main" +# list_asset_types = "examples.widgets.developer.list_asset_types:main" + + [project.urls] Homepage = "https://github.com/odpi/egeria-python" diff --git a/setup.py b/setup.py index 2e0a616..41db4b6 100644 --- a/setup.py +++ b/setup.py @@ -8,45 +8,47 @@ include_package_data= True, # packages=find_packages(where="src"), package_dir={"": "src"}, - scripts=["examples/widgets/operational/view_server_status.py", - "examples/widgets/operational/view_eng_action_status.py", - "examples/widgets/operational/view_platform_status.py", - "examples/widgets/operational/view_coco_status.py", - "examples/widgets/operational/view_integ_daemon_status.py", - "examples/widgets/operational/view_gov_eng_status.py", - "examples/widgets/operational/view_server_list.py", - "examples/widgets/operational/get_tech_type_elements.py", - "examples/widgets/operational/get_tech_type_template.py", - - "examples/widgets/catalog_user/list_assets.py", - "examples/widgets/catalog_user/view_asset_graph.py", - "examples/widgets/catalog_user/view_collection.py", - "examples/widgets/catalog_user/view_glossary.py", - - "examples/widgets/personal_organizer/list_todos.py", - "examples/widgets/personal_organizer/view_my_todos.py", - "examples/widgets/personal_organizer/view_open_todos.py", - "examples/widgets//personal_organizer/list_projects.py", - "examples/widgets/personal_organizer/get_my_profile.py", - - "examples/widgets/developer/list_asset_types.py", - "examples/widgets/developer/list_relationship_types.py", - "examples/widgets/developer/get_tech_details.py", - "examples/widgets/developer/list_tech_types.py", - "examples/widgets/developer/list_registered_services.py", - "examples/widgets/developer/get_guid_info.py", - "examples/widgets/developer/list_valid_metadata_values.py", - "examples/widgets/developer/list_tech_templates.py", - - - "examples/Doc_Samples/Create_Collection_Sample.py", - "examples/Doc_Samples/Create_Sustainability_Collection_Sample.py", - - ], + # scripts=["examples/widgets/operational/view_server_status.py", + # "examples/widgets/operational/view_eng_action_status.py", + # "examples/widgets/operational/view_platform_status.py", + # "examples/widgets/operational/view_coco_status.py", + # "examples/widgets/operational/view_integ_daemon_status.py", + # "examples/widgets/operational/view_gov_eng_status.py", + # "examples/widgets/operational/view_server_list.py", + # "examples/widgets/operational/get_tech_type_elements.py", + # "examples/widgets/operational/get_tech_type_template.py", + # "examples/widgets/operational/view_asset_events.py", + # + # "examples/widgets/catalog_user/list_assets.py", + # "examples/widgets/catalog_user/view_asset_graph.py", + # "examples/widgets/catalog_user/view_collection.py", + # "examples/widgets/catalog_user/view_glossary.py", + # + # "examples/widgets/personal_organizer/list_todos.py", + # "examples/widgets/personal_organizer/view_my_todos.py", + # "examples/widgets/personal_organizer/view_open_todos.py", + # "examples/widgets//personal_organizer/list_projects.py", + # "examples/widgets/personal_organizer/get_my_profile.py", + # + # "examples/widgets/developer/list_asset_types.py", + # "examples/widgets/developer/list_relationship_types.py", + # "examples/widgets/developer/get_tech_details.py", + # "examples/widgets/developer/list_tech_types.py", + # "examples/widgets/developer/list_registered_services.py", + # "examples/widgets/developer/get_guid_info.py", + # "examples/widgets/developer/list_valid_metadata_values.py", + # "examples/widgets/developer/list_tech_templates.py", + # + # + # "examples/Doc_Samples/Create_Collection_Sample.py", + # "examples/Doc_Samples/Create_Sustainability_Collection_Sample.py", + # + # ], # entry_points = { # 'console_scripts': [ - # 'server_status = examples.widgets.server_status:main', - # 'my_todos = examples.widgets.my_todos:main', + # 'server_status = examples.widgets.operational.server_status:main', + # 'my_todos = examples.widgets.personal_organizer.my_todos:main', + # 'list_asset_types = examples.widgets.developer.list_asset_types:main' # ] # }, @@ -72,12 +74,12 @@ "Programming Language :: Python :: 3", ], python_requires='>=3.10', - install_requires=[ - "requests~=2.31.0", - "validators~=0.22.0", - "pytest~=7.4.2", - "urllib3~=1.26.15", - "rich~=13.7.1", - "httpx~=0.26.0" - ] + # install_requires=[ + # "requests~=2.31.0", + # "validators~=0.22.0", + # "pytest~=7.4.2", + # "urllib3~=1.26.15", + # "rich~=13.7.1", + # "httpx~=0.26.0" + # ] ) diff --git a/src/pyegeria/automated_curation_omvs.py b/src/pyegeria/automated_curation_omvs.py index 38fa94b..37d4a23 100644 --- a/src/pyegeria/automated_curation_omvs.py +++ b/src/pyegeria/automated_curation_omvs.py @@ -13,9 +13,9 @@ from pyegeria import Client, max_paging_size, body_slimmer from pyegeria._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) from ._validators import validate_name, validate_guid, validate_search_string -from .core_guids import (FileFolder_template_GUID, - PostgreSQL_Server_template_GUID, - Apache_Kafka_Server_template_GUID, +from .core_guids import (FILEFOLDER_TEMPLATE_GUID, + POSTGRESQL_SERVER_TEMPLATE_GUID, + APACHE_KAFKA_SERVER_TEMPLATE_GUID, ) @@ -169,7 +169,7 @@ async def _async_create_kafka_server_element_from_template(self, kafka_server: s The GUID of the Kafka server element. """ - body = {"templateGUID": Apache_Kafka_Server_template_GUID, "isOwnAnchor": 'true', + body = {"templateGUID":APACHE_KAFKA_SERVER_TEMPLATE_GUID, "isOwnAnchor": 'true', "placeholderPropertyValues": {"serverName": kafka_server, "hostIdentifier": host_name, "portNumber": port, "description": description}} body_s = body_slimmer(body) @@ -241,7 +241,7 @@ async def _async_create_postgres_server_element_from_template(self, postgres_ser str The GUID of the Postgres server element. """ - body = {"templateGUID": PostgreSQL_Server_template_GUID, "isOwnAnchor": 'true', + body = {"templateGUID":POSTGRESQL_SERVER_TEMPLATE_GUID, "isOwnAnchor": 'true', "placeholderPropertyValues": {"serverName": postgres_server, "hostIdentifier": host_name, "portNumber": port, "databaseUserId": db_user, "description": description, "databasePassword": db_pwd}} @@ -319,7 +319,7 @@ async def _async_create_folder_element_from_template(self, path_name: str, folde str The GUID of the File Folder element. """ - body = {"templateGUID": FileFolder_template_GUID, + body = {"templateGUID": FILEFOLDER_TEMPLATE_GUID, "isOwnAnchor": 'true', "placeholderPropertyValues": { "directoryPathName": path_name, diff --git a/src/pyegeria/core_guids.py b/src/pyegeria/core_guids.py index 8a9c491..127a1ef 100644 --- a/src/pyegeria/core_guids.py +++ b/src/pyegeria/core_guids.py @@ -9,103 +9,95 @@ # Template guids # -FILE_FOLDER_TEMPLATE = "553f51cf-3981-480e-acd8-86ed3e25329d" +CSV_DATA_FILE_TEMPLATE_GUID = '13770F93-13C8-42BE-9BB8-E0B1B1E52B1F' -KAFKA_SERVER_TEMPLATE = "5e1ff810-5418-43f7-b7c4-e6e062f9aff7" +KEYSTORE_FILE_TEMPLATE_GUID = 'FBCFCC0C-1652-421F-B49B-C3E1C108768F' -POSTGRESQL_SERVER_TEMPLATE = "542134e6-b9ce-4dce-8aef-22e8daf34fdb" +OSS_UNITY_CATALOG_FUNCTION_TEMPLATE_GUID = '4AE9F6DF-4678-4B0A-A492-4A982C8397FD' -CSV_Data_File_template_GUID = '1b81010e-8525-43b4-8bd9-40c102f7f7d6' +DATA_FILE_TEMPLATE_GUID = '66D8DDA9-00CF-4E59-938C-4B0583596B1E' -Keystore_File_template_GUID = '754def0b-b811-4ea0-b8bf-7414fa8a77b4' +VIEW_SERVER_TEMPLATE_GUID = 'FD61CA01-390D-4AA2-A55D-426826AA4E1B' -OSS_Unity_Catalog_Function_template_GUID = '4ae9f6df-4678-4b0a-a492-4a982c8397fd' +ARCHIVE_FILE_TEMPLATE_GUID = '7578E504-D00F-406D-A194-3FC0A351CDF9' -Data_File_template_GUID = 'd7633260-0810-43fe-ba48-f3e3e3e7c95c' +POSTGRESQL_RELATIONAL_DATABASE_TEMPLATE_GUID = '3D398B3F-7AE6-4713-952A-409F3DEA8520' -View_Server_template_GUID = 'fd61ca01-390d-4aa2-a55d-426826aa4e1b' +OSS_UNITY_CATALOG_VOLUME_TEMPLATE_GUID = '384386BA-83C0-4981-8553-4306AECE440F' -Archive_File_template_GUID = '8a4ea587-dd3e-4148-8c01-0d366d19de11' +PROGRAM_FILE_TEMPLATE_GUID = '32D27E9C-1FDF-455A-AD2A-42B4D7D99108' -PostgreSQL_Relational_Database_template_GUID = '3d398b3f-7ae6-4713-952a-409f3dea8520' +FILEFOLDER_TEMPLATE_GUID = 'FBDD8EFD-1B69-474C-BB6D-0A304B394146' -OSS_Unity_Catalog_Volume_template_GUID = 'bf4dc272-a323-4ca7-8e37-b78a005ac578' +OSS_UNITY_CATALOG_CATALOG_TEMPLATE_GUID = 'F7B05A3E-913C-497D-96F5-ACDEB2EC897E' -Program_File_template_GUID = 'd8b8cae5-f4bd-4631-8836-88dc67a55c00' +POSTGRESQL_SERVER_TEMPLATE_GUID = '542134E6-B9CE-4DCE-8AEF-22E8DAF34FDB' -FileFolder_template_GUID = '99b0c995-7494-4063-89d1-1e0ec7153abd' +AUDIO_DATA_FILE_TEMPLATE_GUID = '39B4B670-7F15-4744-A5BA-62E8EDAFBCEE' -OSS_Unity_Catalog_Catalog_template_GUID = '8bf8f102-490f-4718-bd27-d018660124b6' +DOCUMENT_FILE_TEMPLATE_GUID = 'EB6F728D-FA54-4350-9807-1199CBF96851' -PostgreSQL_Server_template_GUID = '542134e6-b9ce-4dce-8aef-22e8daf34fdb' +INTEGRATION_DAEMON_TEMPLATE_GUID = '6B3516F0-DD13-4786-9601-07215F995197' -Audio_Data_File_template_GUID = 'f65ea229-5473-469f-a447-32ba09bf1f14' +XML_DATA_FILE_TEMPLATE_GUID = 'EA67AE71-C674-473E-B38B-689879D2A7D9' -Document_File_template_GUID = '080ca599-095a-499e-ba26-7d58e538c32a' +PARQUET_DATA_FILE_TEMPLATE_GUID = '7F6CD744-79C3-4D25-A056-EEB1A91574C3' -Integration_Daemon_template_GUID = '6b3516f0-dd13-4786-9601-07215f995197' +THREED_IMAGE_DATA_FILE_TEMPLATE_GUID = '0059EA2B-6292-4CAC-AA6F-A80A605F1114' -XML_Data_File_template_GUID = '643a284b-3137-41de-8c37-521dcd3a1441' +YAML_FILE_TEMPLATE_GUID = '2221855B-2B64-4B45-A2EE-C40ADC5E2A64' -Parquet_Data_File_template_GUID = '2396c38e-54aa-4d04-a95d-ce02fb998c55' +METADATA_ACCESS_SERVER_TEMPLATE_GUID = 'BD8DE890-FA79-4C24-AAB8-20B41B5893DD' -ThreeD_Image_Data_File_template_GUID = '5648eaa6-4826-4964-9657-78ab9cc387d8' +PROPERTIES_FILE_TEMPLATE_GUID = '3B281111-A0EF-4FC4-99E7-9A0EF84A7636' -YAML_File_template_GUID = '6515915a-c218-4e55-9b2c-d5fbec9dfdb4' +VECTOR_DATA_FILE_TEMPLATE_GUID = 'DB1BEC7F-55A9-40D3-91C0-A57B76D422E2' -Metadata_Access_Server_template_GUID = 'bd8de890-fa79-4c24-aab8-20b41b5893dd' +APACHE_KAFKA_SERVER_TEMPLATE_GUID = '5E1FF810-5418-43F7-B7C4-E6E062F9AFF7' -Properties_File_template_GUID = '1cefcfe3-585d-4d78-a4dd-3f929f5c5a9b' +OSS_UNITY_CATALOG_SCHEMA_TEMPLATE_GUID = 'A75CFB07-31FE-457E-9298-BE145DC93071' -Vector_Data_File_template_GUID = 'ea60c096-71e6-4492-ba10-90de63e4fe3a' +EXECUTABLE_FILE_TEMPLATE_GUID = '3D99A163-7A13-4576-A212-784010A8302A' -Apache_Kafka_Server_template_GUID = '5e1ff810-5418-43f7-b7c4-e6e062f9aff7' +JSON_DATA_FILE_TEMPLATE_GUID = 'C4836635-7E9E-446A-83B5-15E206B1AFF3' -OSS_Unity_Catalog_Schema_template_GUID = 'd95e5364-4ebf-42d5-bb39-ff1334143b15' +FILE_SYSTEM_TEMPLATE_GUID = '522F228C-097C-4F90-9EFC-26C1F2696F87' -Executable_File_template_GUID = '588c89e7-cc16-4ae1-8b81-0cd90250df0c' +SOURCE_CODE_FILE_TEMPLATE_GUID = '9C7013EF-F29B-4B01-A8EA-5EA14F64C67A' -JSON_Data_File_template_GUID = 'c62ff28b-5cd2-4c74-bba3-0a875ddbbdf4' +OSS_UNITY_CATALOG_SERVER_TEMPLATE_GUID = '1077A346-7A50-4CB0-A795-B219BAFAABF6' -File_System_template_GUID = 'd3b548d5-c5bf-42f7-8714-80a034b00424' +APPLE_MACBOOK_PRO_TEMPLATE_GUID = '32A9FD56-85C9-47FE-A211-9DA3871BF4DA' -Source_Code_File_template_GUID = '092e6742-7d5a-40cb-b5be-b0440e730c0a' +BUILD_INSTRUCTION_FILE_TEMPLATE_GUID = 'FBB2FA2E-8BCB-402E-9BE7-5C6DB9F2C504' -OSS_Unity_Catalog_Server_template_GUID = '1077a346-7a50-4cb0-a795-b219bafaabf6' +SPREADSHEET_DATA_FILE_TEMPLATE_GUID = 'E4FABFF5-2BA9-4050-9076-6ED917970B4C' -Apple_MacBook_Pro_template_GUID = '32a9fd56-85c9-47fe-a211-9da3871bf4da' +UNIX_FILE_SYSTEM_TEMPLATE_GUID = '27117270-8667-41D0-A99A-9118F9B60199' -Build_Instruction_File_template_GUID = '7a2b22a1-2198-4ad6-adc0-8a3c2e2faaa7' +VIDEO_DATA_FILE_TEMPLATE_GUID = '93B2B722-EC0F-4DA4-960A-B8D4922F8BF5' -Spreadsheet_Data_File_template_GUID = '33860da2-c467-4192-908c-f8dab837c098' +POSTGRESQL_RELATIONAL_DATABASE_SCHEMA_TEMPLATE_GUID = '82A5417C-D882-4271-8444-4C6A996A8BFC' -UNIX_File_System_template_GUID = '6d82998d-5d6c-4cd2-902e-8baa98e152d4' +ENGINE_HOST_TEMPLATE_GUID = '1764A891-4234-45F1-8CC3-536AF40C790D' -Video_Data_File_template_GUID = '6d7b46f9-c7ea-4d68-b66b-b077ec91bc19' +AVRO_DATA_FILE_TEMPLATE_GUID = '9F5BE428-058E-41DD-B506-3A222283B579' -PostgreSQL_Relational_Database_Schema_template_GUID = '82a5417c-d882-4271-8444-4c6a996a8bfc' +OSS_UNITY_CATALOG_TABLE_TEMPLATE_GUID = 'F5B12348-92AC-4A52-B8E0-B06CF215484E' -Engine_Host_template_GUID = '1764a891-4234-45f1-8cc3-536af40c790d' +FILE_TEMPLATE_GUID = 'AE3067C7-CC72-4A18-88E1-746803C2C86F' -Avro_Data_File_template_GUID = '0c61cfef-a0d3-4130-85fc-d5c39287499c' +APACHE_KAFKA_TOPIC_TEMPLATE_GUID = 'EA8F81C9-C59C-47DE-9525-7CC59D1251E5' -OSS_Unity_Catalog_Table_template_GUID = 'f5b12348-92ac-4a52-b8e0-b06cf215484e' +SCRIPT_FILE_TEMPLATE_GUID = 'DBD5E6BB-1FF8-46F4-A007-FB0485F68C92' -File_template_GUID = '9725e90e-ebad-474f-af65-a8aaaca03208' +APACHE_ATLAS_SERVER_TEMPLATE_GUID = 'FE6DCE45-A978-4417-AB55-17F05B8BCEA7' -Apache_Kafka_Topic_template_GUID = 'ea8f81c9-c59c-47de-9525-7cc59d1251e5' +RASTER_DATA_FILE_TEMPLATE_GUID = '47211156-F03F-4881-8526-015E695A3DAC' -Script_File_template_GUID = '4842a347-56a1-4940-b340-2f39cf91dc6d' +DATA_FOLDER_TEMPLATE_GUID = '372A0379-7060-4C9D-8D84-BC709B31794C' -Apache_Atlas_Server_template_GUID = 'fe6dce45-a978-4417-ab55-17f05b8bcea7' - -Raster_Data_File_template_GUID = 'c972afee-0170-446f-893b-f88a373a4a99' - -Data_Folder_template_GUID = 'e854455c-8b5a-4030-8289-2323f7f68841' - -OMAG_Server_Platform_template_GUID = '9b06c4dc-ddc8-47ae-b56b-28775d3a96f0' - -DBC_Relational_Database_Integration_Connector_GUID = '70dcd0b7-9f06-48ad-ad44-ae4d7a7762aa' +OMAG_SERVER_PLATFORM_TEMPLATE_GUID = '9B06C4DC-DDC8-47AE-B56B-28775D3A96F0' # # Integration Connector GUIDS @@ -125,4 +117,5 @@ Software_Server_Integration_Connector_GUID = 'b89d9a5a-2ea6-49bc-a4fc-e7df9f3ca93e' -OSS_Unity_Catalog_Server_Integration_Connector_GUID = '06d068d9-9e08-4e67-8c59-073bbf1013af' \ No newline at end of file +OSS_Unity_Catalog_Server_Integration_Connector_GUID = '06d068d9-9e08-4e67-8c59-073bbf1013af' + diff --git a/tests/test_asset_catalog_omvs.py b/tests/test_asset_catalog_omvs.py index 1e42dd5..6de2af8 100644 --- a/tests/test_asset_catalog_omvs.py +++ b/tests/test_asset_catalog_omvs.py @@ -25,7 +25,7 @@ print_exception_response, ) -from pyegeria import FileFolder_template_GUID, PostgreSQL_Server_template_GUID, Apache_Kafka_Server_template_GUID +from pyegeria import FILEFOLDER_TEMPLATE_GUID, POSTGRESQL_SERVER_TEMPLATE_GUID, APACHE_KAFKA_SERVER_TEMPLATE_GUID from pyegeria.asset_catalog_omvs import AssetCatalog @@ -70,7 +70,7 @@ def test_find_asset_in_domain(self): token = g_client.create_egeria_bearer_token(self.good_user_2, "secret") start_time = time.perf_counter() - search_string = "Bunge" + search_string = "Location" response = g_client.find_assets_in_domain(search_string, starts_with=True, ends_with=False, ignore_case=True) duration = time.perf_counter() - start_time @@ -100,7 +100,7 @@ def test_find_asset_in_domain(self): def test_get_asset_graph(self, server:str = good_view_server_1): try: server_name = server - asset_guid ="8e35b39e-6ee7-4d60-aff5-4b09406c5e79" + asset_guid ="bc2931d4-5837-47e5-ba8b-c4dbdf26512d" a_client = AssetCatalog(server_name, self.good_platform1_url, user_id=self.good_user_2) @@ -209,7 +209,7 @@ def test_create_folder_asset_body(self, server: str = good_view_server_1): token = a_client.create_egeria_bearer_token(self.good_user_2, "secret") body = { - "templateGUID" : FileFolder_template_GUID, + "templateGUID" : FILEFOLDER_TEMPLATE_GUID, "isOwnAnchor" : True, "placeholderPropertyValues" : { "clinicalTrialId" : "TransMorg-1",