ckan / ckan/ckanapi

Provide example of how to use the new package_revise

Open
#181 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
212
Forks
81
PR merge metrics
No merged PRs in 30d

Description

How do I use the new CKAN 2.9 function package_revise?

Currently to do a resource update with file upload, I can do something like:

```python
file = open('/tmp/datafile.xlsx', 'rb')
files = [('upload', file)]
call_action('resource_update', {'id': 'my uuid', 'name': 'MyResource'...}, apikey=xyz, files=files)

```

Let's say I have a dataset with name "MyDataset" I want to update, removing resources 0 and 2, updating the description of resource 1 and uploading a new file for resource 1. I understand from documentation that the parameters would be something like:

```
match = {"name":"MyDataset"}
filter = ["-resources__0", "-resources__2"]
update = {"resources__1__description": "My new description"}
update__resources__1__upload@/tmp/datafile.xlsx
```

Can you show in code how I pass those things in the call_action? For example, do they all go in the second parameter (data_dict) and if so, how does the file upload one go in there since it isn't a key value pair? Do I still need to use the "files" parameter?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.