[ckan-dev] Rollback when resource creation fails

Hendrik Bunke h.bunke at zbw.eu
Wed Apr 6 12:16:03 UTC 2016


You can purge the trash via API, see here:
http://stackoverflow.com/questions/30153596/delete-and-purge-a-package-in-ckan-using-api

Will you publish the plugin? We'd be quite interested in that :-)

regards
hendrik

--On 2016-04-06 12:32, Martin Burchell wrote:
> We're writing a plugin to create a dataset and associated resources from an
> uploaded zip file. If a resource fails to be created (for example if a file
> is too large), we want a way to delete the dataset completely so that the
> user can try again. Ideally we'd like to be able to create datasets and
> resources within a transaction but this doesn't seem to be possible from the
> API. Is this correct?
> 
> We are generating the dataset names from the meta data in the zip file. If
> we catch the error on resource creation and delete the dataset, the dataset
> ends up in the Trash, which means that when the user tries to reimport the
> dataset, the name will be the same and they will get the error "That URL is
> already in use." We might be able to change the deleted dataset to avoid the
> clash, but this doesn't seem too satisfactory a solution.
> 
> Can anyone see a better way of doing this?
> 
> 
> Best regards,
> 
> 

-- 
Dr. Hendrik Bunke
ZBW - Leibniz Information Centre for Economics
--Innovative Information Systems and Publishing Technologies--
Tel.: +49 40 42834 454 (Hamburg) OR +49 421 7940430 (homeoffice)
http://zbw.eu



More information about the ckan-dev mailing list