[ckan-dev] CKAN Dataset Update

Adrià Mercader adria.mercader at okfn.org
Tue Feb 28 10:43:46 UTC 2017


Hi Abdel-Rahman,

The API operations are not atomic, meaning that you need to send the
full object including the changes you want to the package_update
endpoint. Something like the following (using ckanapi [1]):

# Get current metadata
my_dataset = ckan.action.package_show(id='xxx')

# Add new resource
my_dataset['resources'].append({'format': 'csv', 'url':
'http://example.com', ...})

# Send the new update
ckan.action.package_update(**my_dataset)


Hope this helps,

Adrià

[1] https://github.com/ckan/ckanapi#ckanapi-python-module

On 25 February 2017 at 19:46, Abdel-Rahman Tawil
<Abdel-Rahman.Tawil at bcu.ac.uk> wrote:
> Hi
>
> Is it possible to update Datasets (a CSV file) using the CKAN API?
> I want to add (append) a new record to an already  existing dataset without
> deleting the CSV file.
>
> Can anybody help please?
>
> Best regards
> Abdel-Rahman
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>



More information about the ckan-dev mailing list