pyegeria 1.5.1.0.1__tar.gz → 1.5.1.0.2__tar.gz

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.
Files changed (105) hide show
  1. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/PKG-INFO +1 -1
  2. pyegeria-1.5.1.0.2/commands/cat/list_deployed_database_schemas.py +197 -0
  3. pyegeria-1.5.1.0.2/commands/cat/list_deployed_databases.py +185 -0
  4. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyproject.toml +2 -2
  5. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/LICENSE +0 -0
  6. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/README.md +0 -0
  7. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/README.md +0 -0
  8. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/__init__.py +0 -0
  9. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_asset_graph.py +0 -0
  10. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_collection.py +0 -0
  11. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_project_dependencies.py +0 -0
  12. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_project_structure.py +0 -0
  13. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_tech_type_elements.py +0 -0
  14. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/get_tech_type_template.py +0 -0
  15. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_archives.py +0 -0
  16. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_assets.py +0 -0
  17. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_cert_types.py +0 -0
  18. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_glossary.py +0 -0
  19. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_projects.py +0 -0
  20. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_relationships.py +0 -0
  21. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_tech_types.py +0 -0
  22. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_todos.py +0 -0
  23. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cat/list_user_ids.py +0 -0
  24. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/__init__.py +0 -0
  25. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/egeria.py +0 -0
  26. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/egeria_cat.py +0 -0
  27. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/egeria_my.py +0 -0
  28. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/egeria_ops.py +0 -0
  29. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/egeria_tech.py +0 -0
  30. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/cli/ops_config.py +0 -0
  31. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/README.md +0 -0
  32. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/__init__.py +0 -0
  33. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/list_my_profile.py +0 -0
  34. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/list_my_roles.py +0 -0
  35. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/monitor_my_todos.py +0 -0
  36. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/monitor_open_todos.py +0 -0
  37. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/my/todo_actions.py +0 -0
  38. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/README.md +0 -0
  39. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/__init__.py +0 -0
  40. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/engine_actions.py +0 -0
  41. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/gov_server_actions.py +0 -0
  42. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/list_catalog_targets.py +0 -0
  43. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/load_archive.py +0 -0
  44. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_asset_events.py +0 -0
  45. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_engine_activity.py +0 -0
  46. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_engine_activity_c.py +0 -0
  47. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_gov_eng_status.py +0 -0
  48. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_integ_daemon_status.py +0 -0
  49. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_platform_status.py +0 -0
  50. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_server_startup.py +0 -0
  51. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/monitor_server_status.py +0 -0
  52. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/orig_monitor_server_list.py +0 -0
  53. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/orig_monitor_server_status.py +0 -0
  54. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/refresh_integration_daemon.py +0 -0
  55. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/ops/restart_integration_daemon.py +0 -0
  56. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/README.md +0 -0
  57. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/__init__.py +0 -0
  58. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/get_element_graph.py +0 -0
  59. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/get_element_info.py +0 -0
  60. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/get_guid_info.py +0 -0
  61. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/get_tech_details.py +0 -0
  62. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_asset_types.py +0 -0
  63. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_elements.py +0 -0
  64. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_elements_for_classification.py +0 -0
  65. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_elements_x.py +0 -0
  66. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_registered_services.py +0 -0
  67. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_related_elements.py +0 -0
  68. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_related_specification.py +0 -0
  69. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_relationship_types.py +0 -0
  70. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_tech_templates.py +0 -0
  71. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/list_valid_metadata_values.py +0 -0
  72. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/commands/tech/x_list_related_elements.py +0 -0
  73. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/README.md +0 -0
  74. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/__init__.py +0 -0
  75. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/_client.py +0 -0
  76. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/_deprecated_gov_engine.py +0 -0
  77. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/_exceptions.py +0 -0
  78. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/_globals.py +0 -0
  79. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/_validators.py +0 -0
  80. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/asset_catalog_omvs.py +0 -0
  81. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/automated_curation_omvs.py +0 -0
  82. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/classification_manager_omvs.py +0 -0
  83. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/collection_manager_omvs.py +0 -0
  84. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/core_omag_server_config.py +0 -0
  85. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/create_tech_guid_lists.py +0 -0
  86. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/egeria_cat_client.py +0 -0
  87. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/egeria_client.py +0 -0
  88. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/egeria_config_client.py +0 -0
  89. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/egeria_my_client.py +0 -0
  90. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/egeria_tech_client.py +0 -0
  91. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/feedback_manager_omvs.py +0 -0
  92. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/full_omag_server_config.py +0 -0
  93. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/glossary_browser_omvs.py +0 -0
  94. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/glossary_manager_omvs.py +0 -0
  95. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/mermaid_utilities.py +0 -0
  96. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/my_profile_omvs.py +0 -0
  97. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/platform_services.py +0 -0
  98. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/project_manager_omvs.py +0 -0
  99. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/registered_info.py +0 -0
  100. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/runtime_manager_omvs.py +0 -0
  101. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/server_operations.py +0 -0
  102. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/tech_guids_26-09-2024 09:30.py +0 -0
  103. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/utils.py +0 -0
  104. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/valid_metadata_omvs.py +0 -0
  105. {pyegeria-1.5.1.0.1 → pyegeria-1.5.1.0.2}/pyegeria/x_action_author_omvs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 1.5.1.0.1
3
+ Version: 1.5.1.0.2
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -0,0 +1,197 @@
1
+ """This creates a templates guid file from the core metadata archive"""
2
+ from rich.markdown import Markdown
3
+ from rich.prompt import Prompt
4
+ import os
5
+ import argparse
6
+ import time
7
+ import sys
8
+ from rich import box
9
+ from rich.console import Console
10
+ from rich.table import Table
11
+
12
+ from pyegeria import (
13
+ InvalidParameterException,
14
+ PropertyServerException,
15
+ UserNotAuthorizedException,
16
+ print_exception_response,
17
+ EgeriaTech,
18
+ )
19
+
20
+
21
+ console = Console()
22
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
23
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
24
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
25
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
26
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
27
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
28
+ )
29
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
30
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
31
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
32
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
33
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
34
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
35
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
36
+
37
+
38
+ def check_if_template(header: dict) -> bool:
39
+ """Check if the the template classification is set"""
40
+ classifications = header.get("classifications", None)
41
+ if classifications is None:
42
+ return False
43
+ for c in classifications:
44
+ if c["type"]["typeName"] == "Template":
45
+ return True
46
+ return False
47
+
48
+
49
+ def list_deployed_database_schemas(
50
+ db_name: str,
51
+ server: str,
52
+ url: str,
53
+ username: str,
54
+ password: str,
55
+ jupyter: bool = EGERIA_JUPYTER,
56
+ width: int = EGERIA_WIDTH,
57
+ ):
58
+ c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
59
+ token = c_client.create_egeria_bearer_token()
60
+
61
+ def generate_table() -> Table:
62
+ """Make a new table."""
63
+ table = Table(
64
+ caption=f"Databases found: {url} - {server} @ {time.asctime()}",
65
+ style="bold bright_white on black",
66
+ row_styles=["bold bright_white on black"],
67
+ header_style="white on dark_blue",
68
+ title_style="bold bright_white on black",
69
+ caption_style="white on black",
70
+ show_lines=True,
71
+ box=box.ROUNDED,
72
+ # title=f"Elements for Open Metadata Type: '{om_type}' ",
73
+ expand=True,
74
+ # width=500
75
+ )
76
+
77
+ table.add_column("Name")
78
+ table.add_column("Type")
79
+ table.add_column("Created", width=23)
80
+ table.add_column("Home Store")
81
+ table.add_column("GUID", width=38, no_wrap=True)
82
+ table.add_column("Properties")
83
+ table.add_column("Tables")
84
+
85
+ om_type = "DeployedDatabaseSchema"
86
+ if db_name in (None, "*"):
87
+ dbs = c_client.get_elements(om_type)
88
+ else:
89
+ dbs = c_client.get_elements_by_property_value(db_name, "name", om_type)
90
+
91
+ if type(dbs) is list:
92
+ for element in dbs:
93
+ header = element["elementHeader"]
94
+
95
+ if check_if_template(header):
96
+ continue
97
+
98
+ el_name = element["properties"].get("name", "---")
99
+ el_type = header["type"]["typeName"]
100
+ el_home = header["origin"]["homeMetadataCollectionName"]
101
+ el_create_time = header["versions"]["createTime"][:-10]
102
+ el_created_by = header["versions"]["createdBy"]
103
+ el_created_md = (
104
+ f"* **Created By**: {el_created_by}\n"
105
+ f"* **Created Time**: {el_create_time}"
106
+ )
107
+ el_created_out = Markdown(el_created_md)
108
+
109
+ el_guid = header["guid"]
110
+
111
+ el_props_md = ""
112
+ for prop in element["properties"].keys():
113
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
114
+ el_props_out = Markdown(el_props_md)
115
+
116
+ rel_elements = c_client.get_related_elements(
117
+ el_guid, "RelationalDBSchemaType"
118
+ )
119
+ schema_md = ""
120
+ count = 0
121
+ rel_el_out = ""
122
+ if type(rel_elements) is list:
123
+ print(len(rel_elements))
124
+ for rel_element in rel_elements:
125
+ count += 1
126
+ rel_type = rel_element["relatedElement"]["elementHeader"][
127
+ "type"
128
+ ]["typeName"]
129
+ rel_guid = rel_element["relatedElement"]["elementHeader"][
130
+ "guid"
131
+ ]
132
+ rel_props = rel_element["relatedElement"]["properties"]
133
+ props_md = ""
134
+ for key in rel_props.keys():
135
+ props_md += f"* **{key}**: {rel_props[key]}\n"
136
+ rel_el_md = f"* **{rel_type}**: {rel_guid}\n{props_md}"
137
+ if count > 1:
138
+ rel_el_md += "---\n"
139
+ rel_el_out = Markdown(rel_el_md)
140
+
141
+ table.add_row(
142
+ el_name,
143
+ el_type,
144
+ el_created_out,
145
+ el_home,
146
+ el_guid,
147
+ el_props_out,
148
+ rel_el_out,
149
+ )
150
+
151
+ return table
152
+ else:
153
+ print("No instances found")
154
+ sys.exit(1)
155
+
156
+ try:
157
+ console = Console(width=width, force_terminal=not jupyter)
158
+
159
+ with console.pager(styles=True):
160
+ console.print(generate_table())
161
+
162
+ except (
163
+ InvalidParameterException,
164
+ PropertyServerException,
165
+ UserNotAuthorizedException,
166
+ ) as e:
167
+ print_exception_response(e)
168
+ print("\n\nPerhaps the type name isn't known")
169
+ finally:
170
+ c_client.close_session()
171
+
172
+
173
+ def main():
174
+ parser = argparse.ArgumentParser()
175
+ parser.add_argument("--server", help="Name of the server to display status for")
176
+ parser.add_argument("--url", help="URL Platform to connect to")
177
+ parser.add_argument("--userid", help="User Id")
178
+ parser.add_argument("--password", help="Password")
179
+
180
+ args = parser.parse_args()
181
+
182
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
183
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
184
+ userid = args.userid if args.userid is not None else EGERIA_USER
185
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
186
+
187
+ try:
188
+ db_name = Prompt.ask(
189
+ "Enter the name of a database to retrieve schemas for", default="*"
190
+ )
191
+ list_deployed_database_schemas(db_name, server, url, userid, password)
192
+ except KeyboardInterrupt:
193
+ pass
194
+
195
+
196
+ if __name__ == "__main__":
197
+ main()
@@ -0,0 +1,185 @@
1
+ """This creates a templates guid file from the core metadata archive"""
2
+ from rich.markdown import Markdown
3
+ from rich.prompt import Prompt
4
+ import os
5
+ import argparse
6
+ import time
7
+ import sys
8
+ from rich import box
9
+ from rich.console import Console
10
+ from rich.table import Table
11
+
12
+ from pyegeria import (
13
+ InvalidParameterException,
14
+ PropertyServerException,
15
+ UserNotAuthorizedException,
16
+ print_exception_response,
17
+ EgeriaTech,
18
+ )
19
+
20
+
21
+ console = Console()
22
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
23
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
24
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
25
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
26
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
27
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
28
+ )
29
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
30
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
31
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
32
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
33
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
34
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
35
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
36
+
37
+
38
+ def check_if_template(header: dict) -> bool:
39
+ """Check if the the template classification is set"""
40
+ classifications = header.get("classifications", None)
41
+ if classifications is None:
42
+ return False
43
+ for c in classifications:
44
+ if c["type"]["typeName"] == "Template":
45
+ return True
46
+ return False
47
+
48
+
49
+ def list_deployed_databases(
50
+ server: str,
51
+ url: str,
52
+ username: str,
53
+ password: str,
54
+ jupyter: bool = EGERIA_JUPYTER,
55
+ width: int = EGERIA_WIDTH,
56
+ ):
57
+ c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
58
+ token = c_client.create_egeria_bearer_token()
59
+
60
+ def generate_table() -> Table:
61
+ """Make a new table."""
62
+ table = Table(
63
+ caption=f"Databases found: {url} - {server} @ {time.asctime()}",
64
+ style="bold bright_white on black",
65
+ row_styles=["bold bright_white on black"],
66
+ header_style="white on dark_blue",
67
+ title_style="bold bright_white on black",
68
+ caption_style="white on black",
69
+ show_lines=True,
70
+ box=box.ROUNDED,
71
+ # title=f"Elements for Open Metadata Type: '{om_type}' ",
72
+ expand=True,
73
+ # width=500
74
+ )
75
+
76
+ table.add_column("Qualified Name")
77
+ table.add_column("Type")
78
+ table.add_column("Created", width=23)
79
+ table.add_column("Home Store")
80
+ table.add_column("GUID", width=38, no_wrap=True)
81
+ table.add_column("Properties")
82
+ table.add_column("Schemas")
83
+
84
+ om_type = "Database"
85
+ dbs = c_client.get_elements(om_type)
86
+ if type(dbs) is list:
87
+ for element in dbs:
88
+ header = element["elementHeader"]
89
+
90
+ if check_if_template(header):
91
+ continue
92
+
93
+ el_q_name = element["properties"].get("qualifiedName", "---")
94
+ el_type = header["type"]["typeName"]
95
+ el_home = header["origin"]["homeMetadataCollectionName"]
96
+ el_create_time = header["versions"]["createTime"][:-10]
97
+ el_created_by = header["versions"]["createdBy"]
98
+ el_created_md = (
99
+ f"* **Created By**: {el_created_by}\n"
100
+ f"* **Created Time**: {el_create_time}"
101
+ )
102
+ el_created_out = Markdown(el_created_md)
103
+
104
+ el_guid = header["guid"]
105
+
106
+ el_props_md = ""
107
+ for prop in element["properties"].keys():
108
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
109
+ el_props_out = Markdown(el_props_md)
110
+
111
+ rel_elements = c_client.get_related_elements(el_guid)
112
+ schema_md = ""
113
+ count = 0
114
+ if type(rel_elements) is list:
115
+ for rel_element in rel_elements:
116
+ count += 1
117
+ rel_type = rel_element["relatedElement"]["elementHeader"][
118
+ "type"
119
+ ]["typeName"]
120
+ rel_guid = rel_element["relatedElement"]["elementHeader"][
121
+ "guid"
122
+ ]
123
+ rel_props = rel_element["relatedElement"]["properties"]
124
+ props_md = ""
125
+ for key in rel_props.keys():
126
+ props_md += f"* **{key}**: {rel_props[key]}\n"
127
+ rel_el_md = f"* **{rel_type}**: {rel_guid}\n{props_md}"
128
+ if count > 1:
129
+ rel_el_md += "---\n"
130
+ rel_el_out = Markdown(rel_el_md)
131
+
132
+ table.add_row(
133
+ el_q_name,
134
+ el_type,
135
+ el_created_out,
136
+ el_home,
137
+ el_guid,
138
+ el_props_out,
139
+ rel_el_out,
140
+ )
141
+
142
+ return table
143
+ else:
144
+ print("No instances found")
145
+ sys.exit(1)
146
+
147
+ try:
148
+ console = Console(width=width, force_terminal=not jupyter)
149
+
150
+ with console.pager(styles=True):
151
+ console.print(generate_table())
152
+
153
+ except (
154
+ InvalidParameterException,
155
+ PropertyServerException,
156
+ UserNotAuthorizedException,
157
+ ) as e:
158
+ print_exception_response(e)
159
+ print("\n\nPerhaps the type name isn't known")
160
+ finally:
161
+ c_client.close_session()
162
+
163
+
164
+ def main():
165
+ parser = argparse.ArgumentParser()
166
+ parser.add_argument("--server", help="Name of the server to display status for")
167
+ parser.add_argument("--url", help="URL Platform to connect to")
168
+ parser.add_argument("--userid", help="User Id")
169
+ parser.add_argument("--password", help="Password")
170
+
171
+ args = parser.parse_args()
172
+
173
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
174
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
175
+ userid = args.userid if args.userid is not None else EGERIA_USER
176
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
177
+
178
+ try:
179
+ list_deployed_databases(server, url, userid, password)
180
+ except KeyboardInterrupt:
181
+ pass
182
+
183
+
184
+ if __name__ == "__main__":
185
+ main()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyegeria"
3
- version = "1.5.1.0.1"
3
+ version = "1.5.1.0.2"
4
4
  license = 'Apache 2.0'
5
5
  authors = ["Dan Wolfson <dan.wolfson@pdr-associates.com>"]
6
6
  readme = "README.md"
@@ -120,4 +120,4 @@ pytest = "^8.2.2"
120
120
  list_related_elements = "commands.tech.list_related_elements:main"
121
121
 
122
122
  list_valid_metadata_values = "commands.tech.list_valid_metadata_values:main"
123
- list_get_element_graph = "commands.tech.get_element_graph:main"
123
+ list_element_graph = "commands.tech.get_element_graph:main"
File without changes
File without changes