pyegeria 1.5.1.1.17__py3-none-any.whl → 1.5.1.1.19__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/_client.py CHANGED
@@ -10,7 +10,7 @@ import asyncio
10
10
  import inspect
11
11
  import json
12
12
  import os
13
-
13
+ from pyegeria import body_slimmer
14
14
  import httpx
15
15
  from httpx import AsyncClient, Response
16
16
 
@@ -654,6 +654,72 @@ class Client:
654
654
  integration_guids[display_name] = resource_guid
655
655
  # print(f"Added {display_name} integration connector with GUID {integration_guids[display_name]}")
656
656
 
657
+ async def __async__get_guid__(
658
+ self,
659
+ guid: str = None,
660
+ name: str = None,
661
+ property_name: str = "qualifiedName",
662
+ tech_type: str = None,
663
+ ) -> str:
664
+ """Helper function to return a server_guid - one of server_guid or server_name should
665
+ contain information. If both are None, an exception will be thrown. If both contain
666
+ values, server_guid will be used. If the tech_type is supplied and the property_name is qualifiedName
667
+ then the name will be pre-pended with the tech_type name to form a qualifiedName.
668
+
669
+ An InvalidParameter Exception is thrown if multiple matches
670
+ are found for the given property name. If this occurs, use a qualified name for the property name.
671
+ Async version.
672
+ """
673
+ if guid:
674
+ return guid
675
+ if name:
676
+ if (tech_type) and (property_name == "qualifiedName"):
677
+ name = f"{tech_type}:{name}"
678
+
679
+ body = {
680
+ "class": "NameRequestBody",
681
+ "name": name,
682
+ "namePropertyName": property_name,
683
+ "forLineage": False,
684
+ "forDuplicateProcessing": False,
685
+ "effectiveTime": None,
686
+ }
687
+ url = (
688
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
689
+ f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
690
+ )
691
+
692
+ response: Response = await self._async_make_request(
693
+ "POST", url, body_slimmer(body), time_out=self.time_out
694
+ )
695
+
696
+ return response.json().get("guid", "No elements found")
697
+ else:
698
+ raise InvalidParameterException(
699
+ "Neither server_guid nor server_name were provided - please provide."
700
+ )
701
+
702
+ def __get_guid__(
703
+ self,
704
+ guid: str = None,
705
+ name: str = None,
706
+ property_name: str = "qualifiedName",
707
+ tech_type: str = None,
708
+ ) -> str:
709
+ """Helper function to return a server_guid - one of server_guid or server_name should
710
+ contain information. If both are None, an exception will be thrown. If both contain
711
+ values, server_guid will be used. If the tech_type is supplied and the property_name is qualifiedName
712
+ then the name will be pre-pended with the tech_type name to form a qualifiedName.
713
+
714
+ An InvalidParameter Exception is thrown if multiple matches
715
+ are found for the given property name. If this occurs, use a qualified name for the property name.
716
+ """
717
+ loop = asyncio.get_event_loop()
718
+ result = loop.run_until_complete(
719
+ self.__async__get_guid__(guid, name, property_name, tech_type)
720
+ )
721
+ return result
722
+
657
723
 
658
724
  if __name__ == "__main__":
659
725
  print("Main-__client")
@@ -104,7 +104,7 @@ def create_glossary(
104
104
  m_client.close_session()
105
105
 
106
106
 
107
- @click.command("list-glossaries")
107
+ @click.command("glossaries")
108
108
  @click.option("--search-string", default="*", help="Glossaries to search for")
109
109
  @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
110
110
  @click.option(
@@ -323,6 +323,12 @@ def load_terms(
323
323
  m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
324
324
  token = m_client.create_egeria_bearer_token()
325
325
  try:
326
+ if os.path.exists(file_name):
327
+ print(f"Found file at: {file_name}\n")
328
+ else:
329
+ print(f"File not found at: {file_name}\n")
330
+ sys.exit(0)
331
+
326
332
  result = m_client.load_terms_from_file(glossary_name, file_name, upsert=upsert)
327
333
 
328
334
  click.echo(
@@ -23,6 +23,7 @@ from pyegeria import (
23
23
  InvalidParameterException,
24
24
  PropertyServerException,
25
25
  UserNotAuthorizedException,
26
+ EgeriaTech,
26
27
  )
27
28
  from pyegeria.glossary_browser_omvs import GlossaryBrowser
28
29
 
@@ -46,7 +47,8 @@ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
46
47
 
47
48
  def display_glossary_terms(
48
49
  search_string: str,
49
- guid: str,
50
+ glossary_guid: str,
51
+ glossary_name: str,
50
52
  server: str,
51
53
  url: str,
52
54
  username: str,
@@ -54,10 +56,18 @@ def display_glossary_terms(
54
56
  jupyter: bool = EGERIA_JUPYTER,
55
57
  width: int = EGERIA_WIDTH,
56
58
  ):
57
- g_client = GlossaryBrowser(server, url, username, user_password)
59
+ """Display glossary terms in a table"""
60
+ g_client = EgeriaTech(server, url, username, user_password)
58
61
  token = g_client.create_egeria_bearer_token()
62
+ if (glossary_name is not None) and (glossary_name != "*"):
63
+ glossary_guid = g_client.__get_guid__(
64
+ glossary_guid,
65
+ glossary_name,
66
+ "qualifiedName",
67
+ "Glossary",
68
+ )
59
69
 
60
- def generate_table(search_string: str = "*") -> Table:
70
+ def generate_table(search_string: str, glossary_guid: str = None) -> Table:
61
71
  """Make a new table."""
62
72
  table = Table(
63
73
  title=f"Glossary Definitions for Terms like {search_string} @ {time.asctime()}",
@@ -82,7 +92,7 @@ def display_glossary_terms(
82
92
 
83
93
  terms = g_client.find_glossary_terms(
84
94
  search_string,
85
- guid,
95
+ glossary_guid,
86
96
  starts_with=False,
87
97
  ends_with=False,
88
98
  status_filter=[],
@@ -149,7 +159,7 @@ def display_glossary_terms(
149
159
  style="bold bright_white on black", width=width, force_terminal=not jupyter
150
160
  )
151
161
  with console.pager(styles=True):
152
- console.print(generate_table(search_string))
162
+ console.print(generate_table(search_string, glossary_guid))
153
163
 
154
164
  except (
155
165
  InvalidParameterException,
@@ -167,7 +177,7 @@ def main():
167
177
  parser.add_argument("--userid", help="User Id")
168
178
  parser.add_argument("--password", help="User Password")
169
179
  parser.add_argument("--guid", help="GUID of glossary to search")
170
- parser.add_argument("--sustainability", help="Set True for Sustainability Glossary")
180
+
171
181
  args = parser.parse_args()
172
182
 
173
183
  server = args.server if args.server is not None else EGERIA_VIEW_SERVER
@@ -175,11 +185,17 @@ def main():
175
185
  userid = args.userid if args.userid is not None else EGERIA_USER
176
186
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
177
187
  guid = args.guid if args.guid is not None else None
178
- guid = sus_guid if args.sustainability else None
179
188
 
180
189
  try:
181
190
  search_string = Prompt.ask("Enter the term you are searching for:", default="*")
182
- display_glossary_terms(search_string, guid, server, url, userid, user_pass)
191
+ glossary_name = Prompt.ask(
192
+ "Enter the name of the glossary to search or '*' for all glossaries:",
193
+ default="*",
194
+ )
195
+ display_glossary_terms(
196
+ search_string, guid, glossary_name, server, url, userid, user_pass
197
+ )
198
+
183
199
  except KeyboardInterrupt:
184
200
  pass
185
201
 
@@ -790,17 +790,23 @@ def show_assets(ctx, search_string):
790
790
  help="List glossary terms similar to search string - minimum of 4 characters",
791
791
  )
792
792
  @click.option(
793
- "--glossary_guid",
793
+ "--glossary-guid",
794
794
  default=None,
795
795
  help="Optionally restrict search to glossary with the specified guid",
796
796
  )
797
+ @click.option(
798
+ "--glossary-name",
799
+ default="*",
800
+ help="Optionally restrict search to a specific named glossary",
801
+ )
797
802
  @click.pass_context
798
- def show_terms(ctx, search_string, glossary_guid):
803
+ def show_terms(ctx, search_string, glossary_guid, glossary_name):
799
804
  """Find and display glossary terms"""
800
805
  c = ctx.obj
801
806
  display_glossary_terms(
802
807
  search_string,
803
808
  glossary_guid,
809
+ glossary_name,
804
810
  c.view_server,
805
811
  c.view_server_url,
806
812
  c.userid,
@@ -288,17 +288,23 @@ def show_assets(ctx, search_string):
288
288
  help="List glossary terms similar to search string - minimum of 4 characters",
289
289
  )
290
290
  @click.option(
291
- "--glossary_guid",
291
+ "--glossary-guid",
292
292
  default=None,
293
293
  help="Optionally restrict search to glossary with the specified guid",
294
294
  )
295
+ @click.option(
296
+ "--glossary-name",
297
+ default="*",
298
+ help="Optionally restrict search to a specific named glossary",
299
+ )
295
300
  @click.pass_context
296
- def show_terms(ctx, search_string, glossary_guid):
301
+ def show_terms(ctx, search_string, glossary_guid, glossary_name):
297
302
  """Find and display glossary terms"""
298
303
  c = ctx.obj
299
304
  display_glossary_terms(
300
305
  search_string,
301
306
  glossary_guid,
307
+ glossary_name,
302
308
  c.view_server,
303
309
  c.view_server_url,
304
310
  c.userid,
@@ -58,72 +58,6 @@ class RuntimeManager(Client):
58
58
  "Default Local OMAG Server Platform" # this from the core content archive
59
59
  )
60
60
 
61
- async def __async__get_guid__(
62
- self,
63
- guid: str = None,
64
- name: str = None,
65
- property_name: str = "qualifiedName",
66
- tech_type: str = None,
67
- ) -> str:
68
- """Helper function to return a server_guid - one of server_guid or server_name should
69
- contain information. If both are None, an exception will be thrown. If both contain
70
- values, server_guid will be used. If the tech_type is supplied and the property_name is qualifiedName
71
- then the name will be pre-pended with the tech_type name to form a qualifiedName.
72
-
73
- An InvalidParameter Exception is thrown if multiple matches
74
- are found for the given property name. If this occurs, use a qualified name for the property name.
75
- Async version.
76
- """
77
- if guid:
78
- return guid
79
- if name:
80
- if (tech_type) and (property_name == "qualifiedName"):
81
- name = f"{tech_type}:{name}"
82
-
83
- body = {
84
- "class": "NameRequestBody",
85
- "name": name,
86
- "namePropertyName": property_name,
87
- "forLineage": False,
88
- "forDuplicateProcessing": False,
89
- "effectiveTime": None,
90
- }
91
- url = (
92
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
93
- f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
94
- )
95
-
96
- response: Response = await self._async_make_request(
97
- "POST", url, body_slimmer(body), time_out=self.time_out
98
- )
99
-
100
- return response.json().get("guid", "No elements found")
101
- else:
102
- raise InvalidParameterException(
103
- "Neither server_guid nor server_name were provided - please provide."
104
- )
105
-
106
- def __get_guid__(
107
- self,
108
- guid: str = None,
109
- name: str = None,
110
- property_name: str = "qualifiedName",
111
- tech_type: str = None,
112
- ) -> str:
113
- """Helper function to return a server_guid - one of server_guid or server_name should
114
- contain information. If both are None, an exception will be thrown. If both contain
115
- values, server_guid will be used. If the tech_type is supplied and the property_name is qualifiedName
116
- then the name will be pre-pended with the tech_type name to form a qualifiedName.
117
-
118
- An InvalidParameter Exception is thrown if multiple matches
119
- are found for the given property name. If this occurs, use a qualified name for the property name.
120
- """
121
- loop = asyncio.get_event_loop()
122
- result = loop.run_until_complete(
123
- self.__async__get_guid__(guid, name, property_name, tech_type)
124
- )
125
- return result
126
-
127
61
  #
128
62
  # Cohorts
129
63
  #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 1.5.1.1.17
3
+ Version: 1.5.1.1.19
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -1,6 +1,6 @@
1
1
  pyegeria/README.md,sha256=PwX5OC7-YSZUCIsoyHh1O-WBM2hE84sm3Bd4O353NOk,1464
2
2
  pyegeria/__init__.py,sha256=mZOa16y_LUUZevlHVQY-X_q0ZE2mEcgAE-eoe16DLls,21893
3
- pyegeria/_client.py,sha256=hwmsTTzaRttb-oML351vdDpcpnlEBPudGnqp72VpRYs,26025
3
+ pyegeria/_client.py,sha256=yVo08itjEr2z6XGr6f81Xx0o4FFCtm8Gsx0Kg-3Dw3k,28863
4
4
  pyegeria/_deprecated_gov_engine.py,sha256=dWNcwVsE5__dF2u4QiIyQrssozzzOjBbLld8MdpmVCQ,17264
5
5
  pyegeria/_exceptions.py,sha256=NJ7vAhmvusK1ENvY2MMrBB6A6TgpYjzS9QJxFH56b8c,18470
6
6
  pyegeria/_globals.py,sha256=1Uc8392wjbiVN5L__RzxC1-U97RMXj77_iUsMSgeAjQ,638
@@ -9,7 +9,6 @@ pyegeria/asset_catalog_omvs.py,sha256=NUF9C3s_zs9pTfIZyRJlqMCKrhZASJPH08EXzzjki7
9
9
  pyegeria/automated_curation_omvs.py,sha256=BwNuF7XQJAV-POvzaWwFh0TS5yRnHZZPhlayvtIMlwY,130243
10
10
  pyegeria/classification_manager_omvs.py,sha256=3yInuRy7Cf43oSFZ8BuzcIgtGSm5BfvlKYqtWKRMlPU,186678
11
11
  pyegeria/collection_manager_omvs.py,sha256=kye2kjthNnmwxMZhHQKV0xoHbxcNPWjNzRAYOItj_gY,99201
12
- pyegeria/commands/.DS_Store,sha256=nBgW7MKJ6b4wSWyEEeGYHWwC8QJAiteQaWKM9PoNRzY,6148
13
12
  pyegeria/commands/README.md,sha256=zNfWZppDxoKqTJeRtcewzku9z1m6_hKacCyQUQw1iq4,1974
14
13
  pyegeria/commands/__init__.py,sha256=7y3p5oQ2c0C1465oIgSA_123W1uo7Wqwk91LXccUgrw,17
15
14
  pyegeria/commands/cat/README.md,sha256=-aaAnIT2fcfU63vajgB-RzQk4l4yFdhkyVfSaTPiqRY,967
@@ -20,7 +19,7 @@ pyegeria/commands/cat/get_project_dependencies.py,sha256=B0JaMSUi0hzVgos1sTY2uUP
20
19
  pyegeria/commands/cat/get_project_structure.py,sha256=n2GbNd07w1DTo7jTR8b2ewXRyNcat_2BcCBRyDMldwk,5969
21
20
  pyegeria/commands/cat/get_tech_type_elements.py,sha256=-m3Q0BoNqkCtV8h75vMwTcOV-_ymEXmnJcr4Ec7WMAw,6180
22
21
  pyegeria/commands/cat/get_tech_type_template.py,sha256=gMFVcgCIm09GQu1Vsc5ZUVH9XLhItAG1eVGZJrcnHeQ,6174
23
- pyegeria/commands/cat/glossary_actions.py,sha256=UlVf4vsg9Lu8pSd2OXI61MNMqBMeDLCDqpf3zPVT9GY,13315
22
+ pyegeria/commands/cat/glossary_actions.py,sha256=Tcpa9wCFo4D_fsfMilnbVoRerr_8f6Bqtw3hAJdcUvw,13493
24
23
  pyegeria/commands/cat/list_archives.py,sha256=FEZ2XYnQIWo2PztWqnj6unn0pbblPU0-bMbTyI3csv4,5464
25
24
  pyegeria/commands/cat/list_assets.py,sha256=bNwSaBDz661hfnc2Rn4j4HPHAugKvz0XwN9L1m4FVQk,6529
26
25
  pyegeria/commands/cat/list_cert_types.py,sha256=mbCls_EqC5JKG5rvS4o69k7KgZ6aNXlcqoJ3DtHsTFA,7127
@@ -30,12 +29,12 @@ pyegeria/commands/cat/list_deployed_databases.py,sha256=HE8nG-mIlxa9iSUEH-n71o-G
30
29
  pyegeria/commands/cat/list_projects.py,sha256=Jzs-DtIpPhCH-gY4PYT6mnRBWnEf4m18TFfcw8UymNU,8011
31
30
  pyegeria/commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468GYw3Q,5869
32
31
  pyegeria/commands/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
33
- pyegeria/commands/cat/list_terms.py,sha256=Goa5z7y6lfzJNp_YW5r6A9GWKHFXIulzd8lipCSZjsc,6801
32
+ pyegeria/commands/cat/list_terms.py,sha256=zNo8oQo4y3cGIYikBnD9gutPLecwyF8Q3XaOLiLg7tA,7212
34
33
  pyegeria/commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnUI79ir4,6542
35
34
  pyegeria/commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
36
35
  pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
37
- pyegeria/commands/cli/egeria.py,sha256=Ym434efkazLNEdFVm5j4jV-Wm69WKM9YJ1ag66E4szg,31861
38
- pyegeria/commands/cli/egeria_cat.py,sha256=PmUE0uZgyMcxWHJae9gFMMtHWqUKNuHDwvOFn70b34Q,15153
36
+ pyegeria/commands/cli/egeria.py,sha256=CXFDHpuSwASzfbh_9Z2MTQuZzK5ANZdFIB3PBnRODZk,32024
37
+ pyegeria/commands/cli/egeria_cat.py,sha256=-rfM7WKtXwV0OkMF0gMN2YF9lcrtLtSb9TToKoZPR_w,15316
39
38
  pyegeria/commands/cli/egeria_my.py,sha256=Memyxzhrn_i3nMNRor-5N40_SKJJMzylA4iQgBW3T4g,6235
40
39
  pyegeria/commands/cli/egeria_ops.py,sha256=-UqtD4TDv_hhHFSjF0flF55Zo6UFbQcUCYBW_ZMLkx0,11648
41
40
  pyegeria/commands/cli/egeria_tech.py,sha256=iq5D-dl0KW1HbNG8AolJSZoR6hTLp90RD_JjHxVj9Pk,13313
@@ -101,14 +100,14 @@ pyegeria/my_profile_omvs.py,sha256=DyECbUFEcgokrIbzdMMNljC3bqfqKGXAF2wZEpzvRYs,3
101
100
  pyegeria/platform_services.py,sha256=CJIOYIFEbcIGwdWlApAQcXxZTsdrhFtpJcm4O3p7dG0,41646
102
101
  pyegeria/project_manager_omvs.py,sha256=Y7Lyqh4jIujJrr_Ub7feo904FN_uz4R10T4hKhqE1Uw,67499
103
102
  pyegeria/registered_info.py,sha256=y0-LgDIQXpph0lEWxIOG3_HsqX_Z2iAIb3xu4Aa4B70,6344
104
- pyegeria/runtime_manager_omvs.py,sha256=Ex29vbL4iQo2pDgd3zIKyVwGknn6MFRIEB5naIoLD5s,76162
103
+ pyegeria/runtime_manager_omvs.py,sha256=E7LLbJyGXtBC1ze241MWYdG4rk5iBRQcX9NEJrMXIUA,73357
105
104
  pyegeria/server_operations.py,sha256=ciH890hYT85YQ6OpByn4w7s3a7TtvWZpIG5rkRqbcI0,16766
106
105
  pyegeria/template_manager_omvs.py,sha256=heqbKeum5hPCHap4r1RUZU8YB3QaQlxVNbq4GZimJtE,42450
107
106
  pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
108
107
  pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
109
108
  pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
110
- pyegeria-1.5.1.1.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
111
- pyegeria-1.5.1.1.17.dist-info/METADATA,sha256=cmKLawOaDcMWaHjWPqTrjCaxJGzCWRoH_fU3XauAReU,2998
112
- pyegeria-1.5.1.1.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
113
- pyegeria-1.5.1.1.17.dist-info/entry_points.txt,sha256=49rVcJuuKXUSC-9ZNzr-ybsaUL-wm6xrUodCZeKJdGc,4898
114
- pyegeria-1.5.1.1.17.dist-info/RECORD,,
109
+ pyegeria-1.5.1.1.19.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
110
+ pyegeria-1.5.1.1.19.dist-info/METADATA,sha256=OoLOd-kJQbZ0WU79fSXM9V4SrXVjoReUeWxiClYAPhQ,2998
111
+ pyegeria-1.5.1.1.19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
112
+ pyegeria-1.5.1.1.19.dist-info/entry_points.txt,sha256=49rVcJuuKXUSC-9ZNzr-ybsaUL-wm6xrUodCZeKJdGc,4898
113
+ pyegeria-1.5.1.1.19.dist-info/RECORD,,
Binary file