Skip to content

Comments

[HDX-8531] Add new 'update' command#63

Open
agustinhydrolix wants to merge 3 commits intodevfrom
feat/HDX-8531-update-dictionary-files-command
Open

[HDX-8531] Add new 'update' command#63
agustinhydrolix wants to merge 3 commits intodevfrom
feat/HDX-8531-update-dictionary-files-command

Conversation

@agustinhydrolix
Copy link
Contributor

@agustinhydrolix agustinhydrolix commented Oct 3, 2025

This PR introduces two primary enhancements to the dictionary files command set:

  • Adds a new update command, which streamlines the workflow for replacing an existing dictionary file by combining delete and upload operations into a single command.
  • Deprecates the --body-from-file-type option in the existing upload command. The option is now hidden from the --help output. It remains operational to ensure backward compatibility for existing scripts and will display a warning message if used.

Here the --help of the new update command for more information:

hdxcli dictionary files update --help
Usage: hdxcli dictionary files update [OPTIONS] LOCAL_FILE_PATH
                                      REMOTE_FILE_NAME

  Updates an existing dictionary data file by replacing it.

  This command provides a convenient way to replace a remote dictionary file
  with a local version in a single step. It first deletes the existing remote
  file and then uploads the new one.

  The command can be run in two modes:
   - INTERACTIVE: If `REMOTE_FILE_NAME` is not provided, you will be
     prompted to select from a list of existing files.
   - DIRECT: If `REMOTE_FILE_NAME` is provided, the command will target
     that file directly. For safety, a confirmation prompt is still
     shown unless the `--yes` flag is used.

  Examples:
    # Interactively update a dictionary file in the 'my_project' project
    hdxcli dictionary --project my_project files update ./new_countries.csv

    # Directly update 'countries' file after asking for confirmation
    hdxcli dictionary --project my_project files update ./new_countries.csv countries

    # Directly update 'cities' file without any prompts
    hdxcli dictionary --project my_project files update ./new_cities.json cities --yes

Options:
  -y, --yes  Skip the confirmation prompt and proceed with the update.
  --help     Show this message and exit.

Copy link
Collaborator

@hdxscott hdxscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good.

For dictionaries, you should be aware of this work I did recently: https://hydrolix.atlassian.net/browse/HDX-8857

I don’t know what release this is in.

You can use these hashes to determine if the local file the user is uploading is the same as the file that is already uploaded. If the files are the same, you can let the user know and save time.

You could also maybe add a feature just to let users compare the hash of their local file to the remote one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants