OCHA-DAP / hdx-cli-toolkit

A commandline tool for interacting with HDX with a view to doing bulk updates
MIT License
1 stars 0 forks source link

HDX-9984 Allow key specification to be nested #34

Closed IanHopkinson closed 2 months ago

IanHopkinson commented 2 months ago

Purpose

Version for this PR: 2024.7.1

This PR provides functionality to access nested keys in the list command, typically the nested keys of the organization dictionary, or the keys of lists such as tags and groups.

5

Major file changes

The major change is the introduction of a new function, query_dict which is added to utilities.py and tested in test_utilities.py. It is invoked in the "list" command in cli.py: https://github.com/OCHA-DAP/hdx-cli-toolkit/blob/28fe9d8d60e59237b771e449540799c74bfd2d6b/src/hdx_cli_toolkit/cli.py#L102

Minor file changes

As a result of changing the global git config handling line endings, all(?) many lines of code appeared to have changed but I believe this is just a line ending change.

Versioning

hdx-cli-toolkit uses the CalVer versioning scheme with format YYYY.MM.Micro i.e. 2022.12.1 which is updated manually in pyproject.toml. The "Micro" component is simply an integer increased by 1 at each version, starting from 0.

IanHopkinson commented 2 months ago

Pipeline failures are mainly down to the stage API key changing a couple of times!

IanHopkinson commented 2 months ago

@turnerm here's my response to your test cases:

  1. archived,batch – produced two lines a bug – FIXED
  2. resources – produced a dictionary that didn’t fit in the table – it will output correctly to file – FIXED by providing an information message: Field 'resources' is list or dict type, use --output_path to see full output
  3. resources.fs_check_info.state – fails because it is 3 keys deep and first two are lists – FIXED by providing message: resources.fs_check_info.state is nested to depth 3, maximum depth is 2
  4. resources.nonsense – returns five rows with “absent key” – I think this behaviour is correct, we may have situations where some items in the list have the key but others don't - WONTFIX