osducli 0.0.51__py3-none-any.whl → 0.0.52__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.
osducli/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.51
1
+ 0.0.52
@@ -12,12 +12,18 @@
12
12
 
13
13
  """Search service query command"""
14
14
 
15
+ import collections
16
+
15
17
  import click
18
+ from jmespath import Options
19
+ from jmespath import compile as compile_jmespath
16
20
  from osdu_api.model.search.query_request import QueryRequest
17
21
 
18
22
  from osducli.click_cli import CustomClickCommand, State, command_with_output
19
23
  from osducli.cliclient import CliOsduClient, handle_cli_exceptions
20
24
 
25
+ QUERY_JMESPATH_EXPRESSION = compile_jmespath("results[*].{Id:id,Kind:kind,CreateTime:createTime}")
26
+ AGGREGATE_JMESPATH_EXPRESSION = compile_jmespath("sort_by(aggregations,&key)[*].{Key:key,Count:count}")
21
27
 
22
28
  # click entry point
23
29
  @click.command(cls=CustomClickCommand)
@@ -34,7 +40,7 @@ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
34
40
  )
35
41
  @click.option("-a", "--aggregate", "_aggr", help="Aggregate by element", required=False)
36
42
  @handle_cli_exceptions
37
- @command_with_output("results[*].{Id:id,Kind:kind,CreateTime:createTime}")
43
+ @command_with_output(None)
38
44
  def _click_command(state: State, kind: str, _id: str, _query: str, limit: int, _aggr: str):
39
45
  """Search using more advanced query terms"""
40
46
  return query(state, kind, _id, _query, limit, _aggr)
@@ -65,4 +71,9 @@ def query(state: State, kind: str, identifier: str, custom_query: str, limit: in
65
71
 
66
72
  response = search_client.query_records(query_request=request_data)
67
73
  client.check_status_code(response)
68
- return response.json()
74
+ response_data = response.json()
75
+
76
+ if aggregate is not None:
77
+ return AGGREGATE_JMESPATH_EXPRESSION.search(response_data, Options(collections.OrderedDict))
78
+
79
+ return QUERY_JMESPATH_EXPRESSION.search(response_data, Options(collections.OrderedDict))
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osducli
3
- Version: 0.0.51
3
+ Version: 0.0.52
4
4
  Summary: OSDU command line
5
- Author-email: Equinor ASA <mhew@equinor.com>
5
+ Author: OSDU Community
6
6
  License-Expression: Apache-2.0
7
7
  Project-URL: homepage, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli
8
8
  Project-URL: issue-tracker, https://community.opengroup.org/osdu/platform/data-flow/data-loading/osdu-cli/-/issues
@@ -11,7 +11,7 @@ Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Natural Language :: English
13
13
  Classifier: Programming Language :: Python :: 3.13
14
- Requires-Python: >=3.12
14
+ Requires-Python: >=3.13
15
15
  Description-Content-Type: text/x-rst
16
16
  License-File: LICENSE.md
17
17
  Requires-Dist: click
@@ -75,6 +75,10 @@ For more information, specify the `-h` flag:
75
75
  Change Log
76
76
  ==========
77
77
 
78
+ 0.0.52
79
+ ------
80
+ - Fix result for aggregate in search command
81
+
78
82
  0.0.51
79
83
  ------
80
84
  - Get record version command
@@ -1,4 +1,4 @@
1
- osducli/VERSION,sha256=pKLYb8I7W-9_9iuPirYhJ9jzAkpo28gEuYMDA0g7API,6
1
+ osducli/VERSION,sha256=G1mbYZqgx_9E_1oendInfs1C3OixdTj3J-8x9IPDbVY,6
2
2
  osducli/__init__.py,sha256=J3RwqAbN7MWvz8vL24fMUar9Sfk8nMI8xq_aSHGXUy8,591
3
3
  osducli/__main__.py,sha256=4HonhahSaS3Un0f93qnbs_pmJ5pbbVHU-qdhsssVkB0,3661
4
4
  osducli/click_cli.py,sha256=EIe42DOnHDRKU3mPGwT12jI-yX3hsBOp_nS4nMTWc_Y,10864
@@ -70,7 +70,7 @@ osducli/commands/search/_const.py,sha256=YYTZd35Z9O0gEf6kb9Ntonvv3qArkAcszKAq2VA
70
70
  osducli/commands/search/id.py,sha256=1tVbgpDRhW08gyaLfQbCZjFrQDUGPh8gupf7pNhiN6c,1909
71
71
  osducli/commands/search/info.py,sha256=j6cjYDbxiiQEKXs0LJGQ_0scKReCGi6iQJrfn2X0B20,1333
72
72
  osducli/commands/search/kind.py,sha256=9vGVp4QG4dTII4LGcLYKDAE2PmcB-isgiCfwiITVauU,1786
73
- osducli/commands/search/query.py,sha256=nZkOyhz0dTKEHCvICkyeEkfph4Wd6O_p51GTzJg1lEY,2606
73
+ osducli/commands/search/query.py,sha256=4ifV-F3mixs0c05v7wljUdvXE9WU9LR_rjJKbTXDPds,3094
74
74
  osducli/commands/status/__init__.py,sha256=5g1PB_tU0sqP7aplnihjfhMzVVQdlB3Y01QIeHAtSMw,595
75
75
  osducli/commands/status/status.py,sha256=yh6KVUpNYbrLJIH-7GjMyo2MpR8Wvycr4KdkxUI1V5A,4543
76
76
  osducli/commands/storage/__init__.py,sha256=Ilc97Kje3VVLZIBJucd_2jsW1GF5En00xF-A6kiLAFM,585
@@ -236,9 +236,9 @@ osducli/util/file.py,sha256=kfh6SLOI7X54gZ0hWF3kQ1npXPylNYgE1d1_w-fFyr0,1821
236
236
  osducli/util/prompt.py,sha256=0i3eNnxOHRQstvsvfiKnN0lIxXu6sEXIcU8txeYRhNs,7492
237
237
  osducli/util/pypi.py,sha256=-DW5CThkKKiOwLp2tg85BmrLKZzkMI9pu8DyWNPZH6E,1192
238
238
  osducli/util/service_info.py,sha256=YsVvoRoeG1osFjql2AgVkGoj1TePuhBZf3CQXl2a9As,2577
239
- osducli-0.0.51.dist-info/licenses/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
240
- osducli-0.0.51.dist-info/METADATA,sha256=QUUwGY12jCAaYkGbOiLNJjS0IniEkQS_sQ_aSe0Z9xM,6326
241
- osducli-0.0.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
242
- osducli-0.0.51.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
243
- osducli-0.0.51.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
244
- osducli-0.0.51.dist-info/RECORD,,
239
+ osducli-0.0.52.dist-info/licenses/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
240
+ osducli-0.0.52.dist-info/METADATA,sha256=GeVpDwPmeIaWRhbUSh3Lklw_bCDax_4lDCusbo0p2yU,6364
241
+ osducli-0.0.52.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
242
+ osducli-0.0.52.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
243
+ osducli-0.0.52.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
244
+ osducli-0.0.52.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5