[ckan-dev] Deleting datasets does not remove them.

Henrik Korsgaard henrikkorsgaard at gmail.com
Wed Jun 12 07:26:39 UTC 2013


Hi Henrik,

I use the paster commands (purge dataset) on the serve.
http://docs.ckan.org/en/latest/paster.html

Alternatively, I use a javascript in a CKANAdmin page i've build to
understand the API better. The code below is for the datastore delete, but
it would be fairly easy to create similar functions for the Action API
delete methods (
http://docs.ckan.org/en/latest/api.html#module-ckan.logic.action.delete).
For me it was mainly an issue when I tried to understand CKAN, the API and
workflow around publishing datasets to the datastore. I do not know whether
this solves the datasets still being visible under your profile or suit
your needs, but until there is a purge/trash call in the api or GUI, this
is how I do it. Mind your, the code is not production code :)

function datastore_delete(CKAN_base_url, key, resource_id, callback){
    json_data = {"resource_id":resource_id};
    json_data = JSON.stringify(json_data);
    action_post(CKAN_base_url+"/api/3/action/datastore_delete", json_data,
key, callback);
}

function action_post(full_url, json_data, apikey, callback){
var ajax = $.ajax({
url: full_url,
type: "POST",
beforeSend: function (request)
            {
                request.setRequestHeader("Authorization", apikey);
            },
contentType: "application/json",
dataType: "json",
data: json_data
});
ajax.done(function(msg) {
response = {"success":true, "message":msg};
callback(response);
})
ajax.fail(function(jqXHR) {
        response = {"success":false,
"message":JSON.parse(jqXHR.responseText)};
        callback(response);
});
}



On 12 June 2013 08:46, Henrik Aagaard Sørensen <BU1G at tmf.kk.dk> wrote:

> Hi,****
>
> ** **
>
> I’ve actually tried to look through the DOC’s, but cannot find anything
> about that topic. I’ve also tried to search for trash without any luck.***
> *
>
> ** **
>
> Going through the DOC’s for administration only covers paster commands,
> database dumbs and config-file options… L****
>
> ** **
>
> *Fra:* ckan-dev-bounces at lists.okfn.org [mailto:
> ckan-dev-bounces at lists.okfn.org] *På vegne af *Armin Retterath
> *Sendt:* 11. juni 2013 18:35
> *Til:* CKAN Development Discussions
> *Emne:* Re: [ckan-dev] Deleting datasets does not remove them.****
>
> ** **
>
> Hi,
> there is an url like adim/trash where you can remove the old ones in the
> gui. Have a closer look at the docs :-)  .
> Regards,
> Armin****
>
> Am 11.06.2013 15:53 schrieb "Henrik Aagaard Sørensen" <BU1G at tmf.kk.dk>:***
> *
>
> I’ve got a fresh CKAN installation.****
>
>  ****
>
> When I delete datasets it does not seem as they get removed completely.
> They are still located under my user, just with a tag “Deleted” attached.*
> ***
>
>  ****
>
> How do I remove them completely?****
>
>  ****
>
> It’s the same with uploaded files, they are still stores on my harddrive,
> taking up space.****
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev****
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 
Med venlig hilsen - Best regards,

*Henrik Korsgaard*
Phone: +45 22377114
Office: CAVI 114b, Aarhus University

NB. I am slowly migrating my university related correspondence to my
official AU mail: korsgaard at cavi.au.dk - feel free to contact me at that
address if relevant.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130612/20fb00ac/attachment-0001.html>


More information about the ckan-dev mailing list