[ckan-dev] RE> ckan-dev Digest, Vol 34, Issue 64

Ian Ward ian at excess.org
Mon Sep 2 02:28:34 UTC 2013


Hello,

If you are using an API key from an account that is allowed to delete the
dataset and your dataset id is correct then you will be able to delete the
dataset. Please post the real code you are using.

LocalCKAN and TestCKAN are for use in ckan extensions.
On Sep 1, 2013 10:12 PM, "김동수" <kds at gabia.com> wrote:

> Hi~
>
>
>
> 3. Re: how to delete dataset?
>
> =>
>
> * ckanapi.RemoteCKAN, demo.action.package_create ---> success
>
> * ckanapi.RemoteCKAN, demo.call_action('package_delete',
> {'id':'my-dataset'}) ---> denied
>
> * ckanapi.LocalCKAN(), action.package_create ---> ImportError: No module
> named ckan.logic
>
> [ask]
>
> 1. Is it possible to remotely delete(package_create)? (RemoteCKAN)
>
> 2. How can I use the local(LocalCKAN) settings?
>
>
>
> bye~
>
>
>  ------------Original Message------------
>
> *Subject :* ckan-dev Digest, Vol 34, Issue 64
>
> *Date :* 2013-08-31 05:50:56
>
> *From :* ckan-dev-request at lists.okfn.org
>
> *To :* ckan-dev at lists.okfn.org
>
> *Cc :*
>  Send ckan-dev mailing list submissions to
> ckan-dev at lists.okfn.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> or, via email, send a message with subject or body 'help' to
> ckan-dev-request at lists.okfn.org
>
> You can reach the person managing the list at
> ckan-dev-owner at lists.okfn.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ckan-dev digest..."
>
>
> Today's Topics:
>
> 1. Re: How the database should be reset? (Dave Caraway)
> 2. Re: How the database should be reset? (Richard Gomes)
> 3. Re: how to delete dataset? (Richard Gomes)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 30 Aug 2013 07:40:11 -0400
> From: Dave Caraway <dave at fogmine.com>
> Subject: Re: [ckan-dev] How the database should be reset?
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
> Message-ID: <7961587839052840110 at unknownmsgid>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hi richard,
>
> not sure if this helps, but i've seen ghost entries before due to solr
> being out of sync. i used paster command to reindex solr to fix.
>
> -Dave
>
>
>
> On Aug 29, 2013, at 3:38 PM, Richard Gomes <rgomes.info at gmail.com> wrote:
>
> hello,
>
> I loaded test data provided by CKAN into the database.
>
> I don't know if this is relavant... anyway, for your information:
> After that I did some tests using the FileStore API, when I associated
> documents to one of the datasets, like this:
> 1 base_location='http://ckan.localdomain:5000/api'
> 2 api_key= ...
> 3 http_user='rgomes'
> 4 http_pass=...
> 5
> 6
> 7 def filelist(folder='.'):
> 8 import os
> 9 for root, dir, files in os.walk(folder):
> 10 for file in files:
> 11 path = '%s/%s' % (root, file)
> 12 yield path
> 13 return
> 14
> 15
> 16 import ckanclient
> 17 cli = ckanclient.CkanClient(base_location=base_location,
> api_key=api_key, http_user=http_user, http_pass=http_pass, is_verbose=True)
> 18
> 19 pkg = 'warandpeace'
> 20 for path in filelist('/home/rgomes/tmp/upload'):
> 21 print path
> 22 print cli.add_package_resource(pkg, path)
>
>
> Then I've tried to recreate the database from scratch, like this:
>
> #!/bin/bash
>
> set -x
> sudo -u postgres dropdb ${CKAN_DATABASE}
> sudo -u postgres dropuser ${CKAN_USERNAME}
>
> sudo -u postgres createuser -S -D -R -P ${CKAN_USERNAME}
> sudo -u postgres createdb -O ${CKAN_USERNAME} ${CKAN_DATABASE} -E utf-8
>
> paster db init -c $CKAN_ETC/default/development.ini
> paster sysadmin add rgomes -c $CKAN_ETC/default/development.ini
> set +x
>
>
> Notice that I didn't loaded the test data after that!
>
>
> For my surprise, CKAN says that there are 2 datasets available.
> The datasets are not actually listed, but it says that there are 2 datasets
> available.
> The faceted search tags associates 2 datasets to david and 1 to roger,
> etc... like if the datasets where still there.
>
> Any idea about how this sort of information survived a complete wipe out of
> database tables ?
>
> Thanks
>
> --
> Richard Gomes
> http://rgomes.info
> http://www.linkedin.com/in/rgomes
> mobile: +44(77)9955-6813
> inum <http://www.inum.net/>: +883(5100)0800-9804
>
> _______________________________________________
> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.okfn.org/pipermail/ckan-dev/attachments/20130830/d501be24/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Fri, 30 Aug 2013 16:45:32 +0100
> From: Richard Gomes <rgomes.info at gmail.com>
> Subject: Re: [ckan-dev] How the database should be reset?
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
> Message-ID: <5220BE1C.9010607 at gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hi Dave,
>
> Yes, I think it makes sense.
> At the moment I'm reinstalling everything into a VM, but next time I
> will try this.
>
> Cheers :)
>
> Richard Gomes
> http://rgomes.info
> http://www.linkedin.com/in/rgomes
> mobile: +44(77)9955-6813
> inum <http://www.inum.net/>: +883(5100)0800-9804
>
> On 30/08/13 12:40, Dave Caraway wrote:
> > hi richard,
> >
> > not sure if this helps, but i've seen ghost entries before due to solr
> > being out of sync. i used paster command to reindex solr to fix.
> >
> > -Dave
> >
> >
> >
> > On Aug 29, 2013, at 3:38 PM, Richard Gomes <rgomes.info at gmail.com
> > <mailto:rgomes.info at gmail.com>> wrote:
> >
> >> hello,
> >>
> >> I loaded test data provided by CKAN into the database.
> >>
> >> I don't know if this is relavant... anyway, for your information:
> >> After that I did some tests using the FileStore API, when I
> >> associated documents to one of the datasets, like this:
> >> 1 base_location='http://ckan.localdomain:5000/api'
> >> 2 api_key= ...
> >> 3 http_user='rgomes'
> >> 4 http_pass=...
> >> 5
> >> 6
> >> 7 def filelist(folder='.'):
> >> 8 import os
> >> 9 for root, dir, files in os.walk(folder):
> >> 10 for file in files:
> >> 11 path = '%s/%s' % (root, file)
> >> 12 yield path
> >> 13 return
> >> 14
> >> 15
> >> 16 import ckanclient
> >> 17 cli = ckanclient.CkanClient(base_location=base_location,
> >> api_key=api_key, http_user=http_user, http_pass=http_pass,
> >> is_verbose=True)
> >> 18
> >> 19 pkg = 'warandpeace'
> >> 20 for path in filelist('/home/rgomes/tmp/upload'):
> >> 21 print path
> >> 22 print cli.add_package_resource(pkg, path)
> >>
> >>
> >> Then I've tried to recreate the database from scratch, like this:
> >>
> >> #!/bin/bash
> >>
> >> set -x
> >> sudo -u postgres dropdb ${CKAN_DATABASE}
> >> sudo -u postgres dropuser ${CKAN_USERNAME}
> >>
> >> sudo -u postgres createuser -S -D -R -P ${CKAN_USERNAME}
> >> sudo -u postgres createdb -O ${CKAN_USERNAME} ${CKAN_DATABASE} -E utf-8
> >>
> >> paster db init -c $CKAN_ETC/default/development.ini
> >> paster sysadmin add rgomes -c $CKAN_ETC/default/development.ini
> >> set +x
> >>
> >>
> >> Notice that I didn't loaded the test data after that!
> >>
> >>
> >> For my surprise, CKAN says that there are 2 datasets available.
> >> The datasets are not actually listed, but it says that there are 2
> >> datasets available.
> >> The faceted search tags associates 2 datasets to david and 1 to
> >> roger, etc... like if the datasets where still there.
> >>
> >> Any idea about how this sort of information survived a complete wipe
> >> out of database tables ?
> >>
> >> Thanks
> >>
> >> --
> >> Richard Gomes
> >> http://rgomes.info
> >> http://www.linkedin.com/in/rgomes
> >> mobile: +44(77)9955-6813
> >> inum <http://www.inum.net/>: +883(5100)0800-9804
> >>
> >> _______________________________________________
> >> ckan-dev mailing list
> >> ckan-dev at lists.okfn.org <mailto: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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.okfn.org/pipermail/ckan-dev/attachments/20130830/34620c19/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 3
> Date: Fri, 30 Aug 2013 21:50:38 +0100
> From: Richard Gomes <rgomes.info at gmail.com>
> Subject: Re: [ckan-dev] how to delete dataset?
> To: ??? <kds at gabia.com>, CKAN Development Discussions
> <ckan-dev at lists.okfn.org>
> Message-ID: <5221059E.7070904 at gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Hi kds,
>
> I've created a wrapper around API v3. It's here:
> http://paste.ubuntu.com/6045607/
> In the end of the file you see how you can list packages and delete one
> of them.
>
> Note: This is code I've just started to use today, for my own initial
> tests / learning on CKAN.
> There's chance what I will use it in production though, since it makes
> life a lot easier.
> If you find useful, just feel free to use it. No warranties, though.
>
> Cheers :)
>
> Richard Gomes
> http://rgomes.info
> http://www.linkedin.com/in/rgomes
> mobile: +44(77)9955-6813
> inum <http://www.inum.net/>: +883(5100)0800-9804
>
> On 30/08/13 09:08, ??? wrote:
> >
> > Hi~*
> >
> > ckan api should not be deleted --> (package_delete)
> >
> > ==> error message :
> >
> > "urllib2.HTTPError: HTTP Error 403: Forbidden"
> >
> > my role is admin(role --> admin)
> >
> > How ckan api dataset to be deleted is this?
> >
> > or api.. Is there any other way?
> >
> > bye
> >
> >
> >
> > _______________________________________________
> > 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.okfn.org/pipermail/ckan-dev/attachments/20130830/bd17353a/attachment.htm
> >
>
> ------------------------------
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/optionss/ckan-dev
>
>
> End of ckan-dev Digest, Vol 34, Issue 64
> ****************************************
>
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130901/7c9d8a5a/attachment-0001.html>


More information about the ckan-dev mailing list