Repository navigation
Setting Up DRUF on CKAN 2.11.3 datapusher 3.1.0a #331
Description
Setting Up DRUF on CKAN 2.11.3 — Issues & Workarounds
Notes from setting up the DRUF (Dataset Resource Upload First) workflow with DataPusher+ on a CKAN 2.11.3 instance.
Posted here so other developers hit the same wall less hard.
Environment
| Component | Version |
|---|---|
| CKAN | 2.11.3 (stable release) |
| DataPusher+ | latest (main / 0e46e10) |
| Python | 3.10 |
| Prefect | 3.x (as required by DP+) |
| ckanext-scheming | latest |
Issue 1: Prefect Worker Fails to Start — BooleanOptionalAction ImportError
What happened
After installing DataPusher+ and its requirements, attempting to start the Prefect worker immediately crashed with:
ImportError: cannot import name 'BooleanOptionalAction' from 'argparse'
Full traceback:
Traceback (most recent call last):
File ".../pydantic_settings/env_settings.py", line ..., in ...
from argparse import BooleanOptionalAction
ImportError: cannot import name 'BooleanOptionalAction' from 'argparse'
(/path/to/venv/lib/python3.10/site-packages/argparse.py)
Why it happens
pydantic-settings (a Prefect dependency) imports BooleanOptionalAction, which was added to the Python standard library in Python 3.9. On Python 3.10 this should be available without issue.
The problem is that some older pip packages distribute a standalone argparse module and install argparse.py directly into site-packages. Because site-packages is earlier in Python's module search path than the standard library, this legacy file shadows the stdlib argparse, causing the import to fail even on Python 3.10.
You can confirm this is your issue:
python3 -c "import argparse; print(argparse.__file__)"
# If it prints a site-packages path instead of a stdlib path, you have the problem.
# Normal (correct) output looks like: /usr/lib/python3.10/argparse.py
# Problem output looks like: /path/to/venv/lib/python3.10/site-packages/argparse.pyFix
Remove (or rename) the shadowing argparse.py from site-packages:
# Find it
find /path/to/your/venv -name "argparse.py" -path "*/site-packages/*"
# Remove it (or rename to .bak if you want to be cautious)
rm /path/to/your/venv/lib/python3.10/site-packages/argparse.pyAfter removing, verify the stdlib version is now loaded:
python3 -c "import argparse; print(argparse.__file__)"
# Should now print something like: /usr/lib/python3.10/argparse.py
python3 -c "from argparse import BooleanOptionalAction; print('OK')"
# Should print: OKPreventive fix for Docker / CI builds
If you are building in Docker, add a cleanup step after all pip install commands to remove any stray argparse.py that may have been deposited by a transitive dependency:
# Defensive cleanup: remove any legacy argparse.py that shadows the stdlib.
# pydantic-settings (Prefect dep) needs BooleanOptionalAction (stdlib 3.9+).
RUN find /usr/local/lib /usr/lib -name "argparse.py" -path "*/site-packages/*" -delete || trueThe || true prevents the build from failing if no such file exists, which is the normal case.
Issue 2: DRUF Does Not Redirect to Metadata Form After Resource Upload
What happened
After getting the Prefect worker running and enabling DRUF in ckan.ini:
ckanext.datapusher_plus.enable_druf = true
ckanext.datapusher_plus.enable_form_redirect = trueThe workflow partially works — clicking "Add Dataset" correctly skips the metadata form and goes straight to the resource upload page. But after uploading the file and clicking "Add", the user lands on the dataset read page (/dataset/{name}) instead of the metadata edit form (/dataset/{id}/edit).
CKAN request log:
302 POST /dataset/{id}/resource/new
302 GET /dataset/{id}
200 GET /dataset/{dataset-name}
Expected:
302 POST /dataset/{id}/resource/new
302 GET /dataset/{id}/edit
200 GET /dataset/{id}/edit
The dataset ends up published with only the auto-generated placeholder name (e.g. dataset97689) and no real metadata filled in.
Root cause: IFormRedirect does not exist in CKAN 2.11.3
DataPusher+ implements CKAN's IFormRedirect plugin interface to intercept the post-save redirect and point it at the metadata edit form. In plugin.py:
try:
p.implements(p.IFormRedirect)
except (ImportError, AttributeError):
# IFormRedirect not available in this CKAN version
passThe resource_save_redirect method (the one that would return the dataset.edit URL) is only ever called if IFormRedirect is registered — which requires the interface to exist in the CKAN version being used.
IFormRedirect does not exist in any stable CKAN release as of 2.11.3. It was introduced on the unreleased branch 7778-iformredirect. The DataPusher+ README links to this branch under the "Enabling DRUF" section:
"To enable DRUF you need DRUF compatible ckan version" →
https://github.com/ckan/ckan/tree/7778-iformredirect
Because the try/except silently swallows the AttributeError, CKAN starts without error and no warning is logged. The redirect hook simply never fires. CKAN's default post-resource-save redirect logic takes over — which sends the user to the read page.
How CKAN's redirect logic works (relevant context)
In ckan/views/resource.py, after a resource is saved, the redirect destination is determined by the value of a save hidden field posted with the form:
save field value |
What CKAN does |
|---|---|
go-metadata |
Activates the package (state=active), redirects to dataset read page |
go-dataset |
Redirects to dataset edit page (the metadata form) |
go-dataset-complete |
Redirects to dataset read page |
again |
Redirects to resource new page (add another resource) |
CKAN's standard "Add" button in package/snippets/resource_form.html uses value="go-dataset-complete" — which goes to the read page. That is what fires when DRUF's IFormRedirect hook does not exist to intercept it.
Additionally, the DRUF-created package has state='active' (set in druf_view.py). Because the package is not in draft state, CKAN renders the new_resource_not_draft.html template rather than the wizard-stage version — so there is no "Finish" button, only "Add" (go-dataset-complete).
Workaround for CKAN 2.11.3
Since IFormRedirect is unavailable, the workaround is to:
- Have
druf_view.pypass a?druf=1query parameter on its redirect to the resource upload page. - Override
package/snippets/resource_form.htmlin your CKAN extension to detect?druf=1and swap the "Add" button (go-dataset-complete) for a "Save & Fill Metadata" button (go-dataset) — which CKAN already routes todataset.edit.
Step 1 — druf_view.py patch:
# In ckanext/datapusher_plus/druf_view.py, change line 46 from:
return h.redirect_to('dataset_resource.new', id=pkg['id'])
# to:
return h.redirect_to('dataset_resource.new', id=pkg['id'], druf='1')In Flask/CKAN, url_for kwargs that are not part of the URL rule are appended as query string parameters. This produces /dataset/{id}/resource/new?druf=1.
Step 2 — Template override (in your CKAN extension):
Create templates/package/snippets/resource_form.html inside your CKAN extension:
{% ckan_extends %}
{% block add_button %}
{% if request.args.get('druf') %}
<button class="btn btn-primary" name="save" value="go-dataset" type="submit">{{ _('Save & Fill Metadata') }}</button>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}{% ckan_extends %} resolves to CKAN's own resource_form.html snippet. request.args is the Flask query string dict and is available in all CKAN Jinja2 templates.
How the full flow works after the workaround:
- User clicks "Add Dataset" → DRUF view (
POST /resource-first/new) creates placeholder package druf_view.pyredirects toGET /dataset/{id}/resource/new?druf=1- CKAN renders
new_resource_not_draft.html→ loadsresource_form_snippet - Your extension's
resource_form.htmloverride is served;request.args.get('druf')is'1' - "Save & Fill Metadata" button (
value="go-dataset") rendered instead of "Add" - User uploads file and clicks "Save & Fill Metadata"
- Form POSTs to
/dataset/{id}/resource/newwithsave=go-dataset - CKAN saves the resource, hits
elif save_action == 'go-dataset':→ redirects toGET /dataset/{id}/edit - User lands on the metadata edit form
Note: ?druf=1 does not need to be in the form's action URL. The save field value in the POST body is what drives the redirect, not the URL. The query parameter is only needed during the GET (template render) to know which button to show.
Proper fix (awaiting CKAN merge)
The proper solution is for IFormRedirect to be merged into a stable CKAN release. Track the PR here: https://github.com/ckan/ckan/tree/7778-iformredirect. Once that branch lands in a stable CKAN release, the try/except in plugin.py will succeed, resource_save_redirect will be called, and the workaround above will no longer be needed (though it is harmless to leave in place — on CKAN versions that do have IFormRedirect, the ?druf=1 query parameter will still be present and request.args.get('druf') will still return '1', but the redirect will already have been handled correctly by IFormRedirect before the template is even rendered for a second time).
Summary
| # | Issue | Root Cause | Workaround |
|---|---|---|---|
| 1 | Prefect worker crashes — BooleanOptionalAction ImportError |
Legacy argparse.py in site-packages shadows stdlib |
Remove site-packages/argparse.py; add defensive find ... -delete to Docker build |
| 2 | DRUF sends user to read page instead of metadata form | IFormRedirect not in CKAN 2.11.3 (only on unreleased branch 7778-iformredirect) |
Pass ?druf=1 in druf_view.py redirect; override resource_form.html to swap button to go-dataset |
Both workarounds are non-destructive and compatible with future CKAN versions that do implement IFormRedirect.
Activity
a5dur commentedon Jun 24, 2026
Continued Setup Notes — CKAN 2.11.3 + DPP 3.0.0a0 on ARM64 (aarch64)
Environment
site-packages)CKAN plugins (in
.iniorder):Issues From First Run — Status in This Run
BooleanOptionalActionImportErrorargparse.pyIssue 3 (New): DRUF Redirect — Different Workaround Applied
The
?druf=1query-parameter approach described above works cleanly. In this run a slightly different approach was used instead — detecting DRUF state frompkg_dict.resourcesrather than a query parameter — but both achieve the same result.What was done
Because
IFormRedirectstill does not exist in CKAN 2.11.3, a two-file template override was added insideckanext-gztr:templates/package/new_resource_not_draft.html— passespkg_dictto the resource form snippet (it is not passed by default, so the button condition cannot evaluate):{% ckan_extends %} {% block form %} {% snippet resource_form_snippet, data=data, errors=errors, error_summary=error_summary, include_metadata=false, pkg_name=pkg_name, stage=stage, dataset_type=dataset_type, pkg_dict=pkg_dict %} {% endblock %}templates/package/snippets/resource_form.html— swaps the "Add" button for "Save & Fill Metadata" when DRUF is enabled and the package has no resources yet:{% ckan_extends %} {% block add_button %} {% set enable_druf = h.asbool(config.get('ckanext.datapusher_plus.enable_druf', 'false')) %} {% if enable_druf and pkg_dict is defined and pkg_dict and not pkg_dict.resources %} <button class="btn btn-primary" name="save" value="go-dataset" type="submit"> {{ _('Save & Fill Metadata') }} </button> {% else %} {{ super() }} {% endif %} {% endblock %}Why
new_resource_not_draft.htmlmatters: DRUF creates packages withstate=active(not draft), so CKAN rendersnew_resource_not_draft.htmlinstead of the wizard template. That template does not forwardpkg_dictto the snippet, sopkg_dictis alwaysundefinedinsideresource_form.html. The first file above fixes that.Result: After upload, clicking "Save & Fill Metadata" sends
save=go-dataset, andckan/views/resource.pyroutes that toh.redirect_to('{}.edit'.format(package_type), id=id)— the metadata edit form. ✅Issue 4 (New):
FormulaProcessingStage Skipped —ckan.pluginsIs a List in CKAN 2.11.3What happened
After DRUF redirect was fixed, the metadata form opened but suggestion buttons and auto-filled fields were absent. Worker logs showed:
in
ckanext/datapusher_plus/jobs/stages/formula.pyinsideshould_skip().Root cause
In CKAN 2.11.3,
tk.config.get('ckan.plugins', '')returns a Python list, not a string. Theshould_skip()method assumed a string and called.split()on it.Fix applied (in-place patch to
formula.py)After this patch,
FormulaProcessingruns correctly anddpp_suggestionsis populated withSTATUS: "DONE":{ "STATUS": "DONE", "package": { "description": "Dataset contains 41 records with the following columns: station_id, station_name, latitude, longitude, date, parameter, value, unit, quality_flag.", "spatial_description": "Dataset contains geographic point data. Latitude column: \"latitude\", Longitude column: \"longitude\".", "coordinate_system": "WGS84", "update_frequency": "other", "primary_key_field": null } }The
suggestion_formulafields in the schema (description, spatial_description, coordinate_system, update_frequency, primary_key_field) are being evaluated correctly by Jinja2 and the results saved todpp_suggestions.package. ✅Issue 5 (New — Current Blocker): DPP Scheming Form Snippet Templates Not Loading
What's happening
Even with
FormulaProcessingcompleting successfully anddpp_suggestionspopulated, the metadata edit form (/dataset/{id}/edit) shows no suggestion buttons next to fields. The rendered HTML uses ckanext-scheming's standardmarkdown.htmltemplate:DPP's override at
scheming/form_snippets/markdown.htmlshould render:DPP's version is not being used. Same for
select.html(coordinate_system, update_frequency fields) andtext.html(primary_key_field).Root cause:
IConfigurer._reverse_iteration_order = TrueCKAN's
PluginImplementations(IConfigurer)iterates plugins in reverse order of their position inckan.plugins. Fromckan/plugins/interfaces.py:And in
ckan/plugins/core.py:Each call to
tk.add_template_directory()prepends toconfig['plugin_template_paths']:Combined effect: plugins listed earliest in
ckan.pluginshave theirupdate_config()called last (reversed), so they prepend last → end up first inplugin_template_paths→ highest template priority.With
scheming_datasetslisted beforedatapusher_plus:datapusher_plus.update_config()is called first (reversed order, DPP is last in list)scheming_datasets.update_config()is called laterscheming/form_snippets/markdown.htmlwins over DPP'sConfirmed by adding debug logging to
jinja_extensions.get_jinja_env_options():What was tried
Attempt 1: Move
datapusher_plusto the END ofckan.plugins.→ Made it worse. DPP's
update_config()is now called first (reversed), so DPP prepends first → ends up last in the list (lowest priority). Scheming still wins.Attempt 2: Copy DPP's
scheming/form_snippets/*.htmlintockanext-gztr/templates/(gztr has highest priority being latest in the reversed order after scheming).→ Works at the file level but is a maintenance burden (DPP updates don't propagate).
Attempt 3 (current): Use
extra_template_pathsinckan.ini— fromckan/config/environment.py:extra_template_paths=/usr/lib/ckan/default/lib/python3.10/site-packages/ckanext/datapusher_plus/templates→ Still testing. Even with this set, the DPP template marker comment added to
markdown.htmldoes not appear in the rendered page. Investigating whetherupdate_config()is running before or after the Jinja2 environment is built with these paths, or whether a separate Jinja2 cache (in-memoryEnvironment._cache) is serving stale compiled templates.Additional complication: Missing
webassets.yamlDPP 3.0.0a0's
assets/directory hasjs/andstyles/subdirectories but nowebassets.yaml. On startup:This means
{% asset 'datapusher_plus/suggestions' %}(called from DPP'sscheming/snippets/suggestions_asset.html, which DPP'smarkdown.htmlincludes) silently fails. Even if the template were loaded, thescheming-suggestionsJavaScript module would not be served — so the suggestion buttons would remain hidden (style="display:none;"insuggestion_button.html) with no JS to show them.The JS polling mechanism in
scheming-suggestions.jsis designed to:package_showAPI every 2.5 seconds fordpp_suggestionsdpp_suggestions.STATUS == 'DONE'is found: reveal suggestion buttons for fields that have values indpp_suggestions.packageThis is solid architecture — but none of it fires if the asset isn't served.
Prefect / qsv Status
Prefect server: Running in Docker container, healthy at
http://localhost:4200/api. PostgreSQL backend.Prefect worker: Running as a background process connecting to pool
datapusher-plus.qsvdp performance: Solid.
qsvdp 20.1.0-jemalloccompiled foraarch64-unknown-linux-gnu. A 41-row, 9-column test CSV processes through the full pipeline in ~20 seconds end-to-end (most of that is Prefect task orchestration overhead, not qsv). Thestats,frequency,count, andgeocodecommands all run without issue.Pipeline timing: Full job from upload to
STATUS: DONEindpp_suggestionstakes ~22 seconds. Since DRUF redirects to the edit form immediately after upload (~1-2 seconds), the form loads ~20 seconds beforedpp_suggestionsis ready. The JS polling loop handles this correctly in principle (polls up to 40×2.5s = 100 seconds), but since the JS itself isn't loading (webassets issue), it hasn't been observable in practice.Summary
BooleanOptionalActionImportErrorckanext-gztrtemplate override (swapadd_buttonblock)new_resource_not_draft.htmldoesn't passpkg_dictFormulaProcessingskipped —ckan.pluginsreturns listformula.py(isinstancecheck)webassets.yaml— DPP JS assets not served{% asset 'datapusher_plus/suggestions' %}silently failsIConfigurer._reverse_iteration_orderWhat would unblock this
For Issue 5 (webassets): Adding a
webassets.yamlto DPP'sassets/directory that registers thesuggestionsandsuggestions_cssbundles referenced insuggestions_asset.html.For Issue 6 (template priority): Either:
datapusher_plusmust appear beforescheming_datasetsinckan.plugins(counterintuitive given_reverse_iteration_order), ORextra_template_pathsconfig option to explicitly pin DPP's template path ahead of all plugins, ORadd_template_directoryfromIConfigurable.configure()instead ofIConfigurer.update_config(), so it runs after allupdate_configcalls are complete and can prepend last)Setup: CKAN 2.11.3 on Ubuntu 22.04 aarch64, DPP 3.0.0a0, Prefect 3.7.5, qsvdp 20.1.0
a5dur commentedon Jun 25, 2026
✅ DRUF + Suggestion Buttons — All Issues Resolved (CKAN 2.11.3 / DPP 3.0.0a0)
Following up on the previous status comment. Everything is now working. Documenting every fix, including three issues that require upstream changes in this repo.
🔴 Upstream DPP Fixes Required
1. Missing
assets/webassets.yaml— Suggestion buttons never loadSeverity: High — blocks the entire suggestion workflow
DPP 3.0.0a0 ships:
assets/js/scheming-suggestions.jsassets/styles/suggestions.cssassets/js/scheming-ai-suggestions.jsBut there is no
assets/webassets.yaml. CKAN's webassets system callscreate_library("datapusher_plus", assets_path)which looks forwebassets.yamland silently logs a warning and exits if missing. The result:{% asset 'datapusher_plus/suggestions' %}in form snippet templates silently fails, the JS never loads, and suggestion buttons never appear — even whendpp_suggestionsdata is correctly populated.Fix — create
ckanext/datapusher_plus/assets/webassets.yaml:2.
formula.pycrashes on CKAN 2.11.3 — FormulaProcessing always skippedSeverity: High — silently skips suggestion formula evaluation
FormulaStage.should_skip()injobs/stages/formula.pydoes:In CKAN 2.11.3,
tk.config.get('ckan.plugins')returns a Python list, not a string. Calling.split()on a list raisesAttributeError: 'list' object has no attribute 'split', which is caught by the broadexcept Exception, logging a warning and returningTrue(skip). FormulaProcessing is silently skipped on every job.Fix:
3. Template priority conflict with
ckanext-schemingSeverity: Medium — suggestion buttons render wrong template (scheming's instead of DPP's)
DPP provides override templates at
templates/scheming/form_snippets/markdown.html,select.html,text.htmlthat inject suggestion buttons and AI suggestion markup. But CKAN'sIConfigurer._reverse_iteration_order = Truemeans plugins listed earlier inckan.pluginsget higher template priority.If
scheming_datasetsappears beforedatapusher_plusinckan.plugins(which is the natural order since scheming should typically load before DPP), scheming's form_snippet templates win and DPP's overrides are never served.Required plugin order for DPP form_snippets to work:
ckan.plugins = ... datapusher_plus scheming_datasets ...DPP's documentation and README should explicitly warn about this ordering requirement.
✅ What Was Fixed (Our Side)
go-datasetbutton in resource form snippetpackage/new_resource_not_draft.htmlandpackage/snippets/resource_form.htmlFormulaProcessingstage always skippedckan.pluginsis a list in CKAN 2.11.3,.split()crashesformula.pyshould_skip()withisinstancecheckdatapusher_plusbeforescheming_datasetsinckan.pluginsscheming-suggestions.jsnever loadedassets/webassets.yamlwebassets.yamlwith 3 bundle definitionsRecursionErroron dataset add/editextra_template_pathspointed to DPP's templates dir — same path appeared twice incomputed_template_paths, causing infinite{% ckan_extends %}loop between DPP and datastoreextra_template_pathsfromckan.iniEnvironment
🤖 Generated with Claude Code
a5dur commentedon Jul 28, 2026
DRUF on CKAN 2.12 (
dev-v2.12,2.12.0b0) — three more upstream fixesFollow-up to the 2.11.3 write-up above. Same stack brought up on CKAN 2.12 beta with
ckan-devstaller; DPP3.0.0a0(a5dur/datapusher-plus@main), Prefect 3.7, qsvdp 20.1.0, Ubuntu 22.04 aarch64. DPP imports andckan datapusher_plus prefect-deployboth work unchanged. Three DRUF-specific breakages, all in this repo.🔴 1. "Add Dataset" button disappears on organization pages
Severity: High — DRUF entry point is unreachable from an organization
templates/druf/snippets/add_dataset.htmlgates the whole button on agroupvariable:CKAN 2.12 stopped passing it. The call site moved:
organization/read.htmlpackage/snippets/search_results.html:6group=group_dict.iddataset_type=dataset_typeonlyWith the default
ckan.auth.create_unowned_dataset = false, both sides of theorare false and the snippet renders nothing. Core's ownsnippets/add_dataset.htmldegrades gracefully to an unowned link; the DRUF override renders empty.g.group_dictis still set byviews/group.py:433, so the value is recoverable:Passing
owner_orgas an explicit macro argument also removes the reliance on Jinja macro context lookup forgroup.🔴 2. DRUF button form has no CSRF token — 400 on click
Severity: High — blocks the flow even once the button is visible
CKAN 2.12 removed
ckan.csrf_protection.ignore_extensions, so extension forms must carry a token. The DRUF button is a POST toresource_first.newwith none:🔴 3.
enable_drufunreadable from templates — DRUF save button silently reverts to core behaviourSeverity: High — resource upload finishes the dataset instead of going to the metadata form
Symptom: after uploading the first resource, the request redirects to
<type>.read(the dataset page) instead of<type>.edit(the metadata form). The server log shows:which is
save_action == 'go-dataset-complete', i.e. core's "Add" button, not DRUF's "Save & Fill Metadata" (value="go-dataset").Cause is not template priority — that resolves correctly (verified:
scheming/package/snippets/resource_form.html→ DPPtemplates/druf/package/snippets/resource_form.html→ the site override → core). The gating condition evaluates false:From the 2.12 changelog:
Jinja's
configis Flask's config. Before 2.12 CKAN copied its whole config in, so this worked. Now:Compounding it, DPP never declared these options at all — hence
WARNI [ckan.common] Option ckanext.datapusher_plus.enable_druf is not declaredon every startup — and an undeclared option cannot be exported to Flask.Fix — add to
ckanext/datapusher_plus/config_declaration.yaml:Verified after the change:
This is strictly better than patching the consuming template: it repairs the option for every template that reads it, and it silences the undeclared-option warnings.
Not a DPP bug, but it breaks the DRUF flow — ckanext-scheming version gate
On a 2.12 pre-release the resource form shows only "Link", no "Upload".
ckan.__version__is2.12.0b0, and under PEP 4402.12.0b0 < 2.12, so scheming's gate inscheming/form_snippets/upload.html:is_upload_enabled=h.uploads_enabled("resource") if h.check_ckan_version("2.12") else h.uploads_enabled(),takes the legacy branch and calls
h.uploads_enabled()with noobject_type. 2.12's helper logsh.uploads_enabled call without object_type is non supportedand returnsFalse. Usingh.check_ckan_version("2.12.0a0")fixes it and keeps 2.11 on the legacy branch. Filing separately with scheming.Environment
dev-v2.12)a5dur/datapusher-plus@main)dathere@gztr)a5dur commentedon Jul 29, 2026
🔴 4. Every push fails on CKAN 2.12:
Error sending data to datastore (None - {'user_id': ['User not found']})Severity: High — no resource can reach the datastore
Upload log from a clean push (CKAN 2.12.0b0, DPP
3.0.0a0):Cause
ckanext/datapusher_plus/datastore_utils.py,send_resource_to_datastore:ignore_auth: Trueskips the auth check but leavescontext["user"]unset.datastore_createflips thedatastore_activeflag, which updates the resource and therefore creates an activity — and ckanext-activity's create schema (ckanext/activity/logic/schema.py:25) validates:With no user in context,
convert_user_name_or_id_to_idraisesInvalid(_('User not found'))(ckan/logic/validators.py:347), which surfaces as the ValidationError above. Nothing DPP does is wrong auth-wise; the context is simply missing the user that the downstream activity insert requires.Every other function in this module already resolves the site user for exactly this kind of call (
upload_resource,patch_resource, and others all start withsite_user = tk.get_action("get_site_user")(...)) — these three writes were just missed.Fix
The same one-line omission exists in two sibling functions, which fail identically on any re-push (delete-then-recreate path):
delete_datastore_resource→datastore_deletedelete_resource→resource_deleteBoth patched the same way.
Read-only calls in the module (
datastore_search,datastore_info,package_show,resource_show) are unaffected — no activity is created, so the bare{"ignore_auth": True}context is fine there.Note
COPYING 0 rows to Datastore...immediately before the error is not a second bug — the create-table call intentionally passes an emptyrecordslist, with the real data following via a separate COPY that this exception aborted before reaching.Fix is applied locally; posting the analysis now rather than waiting on a full green run, since the root cause and the code path are unambiguous. Will follow up if the re-push surfaces anything further downstream.