Skip to content

HDXTABLE-147 Add datapusher+ and dictionary methods to HDX Python API - #120

Merged
mcarans merged 1 commit into
mainfrom
datapusher-data-dictionary
Oct 15, 2026
Merged

mcarans merged 1 commit into
mainfrom
datapusher-data-dictionary

Conversation

@mcarans

@mcarans mcarans commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resource.submit_to_datapusher(ignore_hash=False) wraps datapusher_submit.
    • Reloads a resource's file into the datastore without re-uploading it, so last_modified is unchanged.
    • Returns False if the job wasn't submitted, e.g. one is already pending.
    • HDX's datastore allowlist and format checks only run on the upload path, so they don't apply here.
  • Resource.get_datapusher_status() wraps datapusher_status and returns None if the resource has no job.
  • Resource.update_hdx_data_dictionary(data_dictionary, replace=False, update_datastore=True):
    • Merges entries by field into the existing hdx_data_dictionary, or replaces it with replace=True.
    • Sends resource_patch with only id and hdx_data_dictionary.
    • If there is a datastore, updates its field labels and descriptions with datastore_create (resource_id, force, fields), keeping other info keys such as type_override. This is the same call CKAN 2.11's Data Dictionary editor makes (ckanext/datastore/blueprint.py DictionaryView.post), so no data is reloaded.

Notifications

Dataset update notifications come from gisrestlayer's change detection, which emits resource-data-changed when a resource's last_modified changes. hdx_data_dictionary is not in its RESOURCE_FIELDS, so neither the patch nor datastore_create produces a notified event. Patching hdx_data_dictionary as well as the datastore stops the next DataPusher+ run from reverting the labels.

Testing

  • Unit tests: new test_datapusher and test_update_hdx_data_dictionary.
    • Merge and replace behaviour.
    • Exact patch and datastore_create bodies.
    • Skipping the datastore update.
    • Validation errors.
  • Live on the feature site (Ebola resource d90385d3-…): update_hdx_data_dictionary(..., replace=True) restored the original dictionary.
    • Datastore descriptions changed and showed in the UI.
    • total (8410) and last_modified were unchanged.
    • Tested with a sysadmin key; whether an org editor without sysadmin rights can call datastore_create is unverified.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Test Results

187 tests  +2   187 ✅ +2   1m 26s ⏱️ +4s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit a9a51de. ± Comparison against base commit b56b343.

♻️ This comment has been updated with latest results.

@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 97.32% (+0.03%) from 97.29% — datapusher-data-dictionary into main

@mcarans mcarans changed the title Add DataPusher+ submission and data dictionary update to Resource HDXTABLE-147 Add datapusher+ and dictionary methods to HDX Python API Oct 15, 2026
- Resource.submit_to_datapusher (datapusher_submit) and
  Resource.get_datapusher_status (datapusher_status)
- Resource.update_hdx_data_dictionary: merges into or replaces
  hdx_data_dictionary via resource_patch, then updates datastore field
  labels/descriptions via datastore_create without reloading data.
  last_modified is unchanged so no dataset update notifications are sent.
@mcarans
mcarans force-pushed the datapusher-data-dictionary branch from 751f400 to a9a51de Compare October 15, 2026 03:21
@mcarans
mcarans merged commit 681c722 into main Oct 15, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants