[ckan-discuss] CKAN - how to create a previously deleted group

Fawcett, David (MNIT) David.Fawcett at state.mn.us
Wed Aug 14 15:30:25 BST 2013


The API route below should be ckan.logic.action.update.group_update(context, data_dict), not 'package_update'.

-----Original Message-----
From: ckan-discuss-bounces at lists.okfn.org [mailto:ckan-discuss-bounces at lists.okfn.org] On Behalf Of Fawcett, David (MNIT)
Sent: Wednesday, August 14, 2013 8:50 AM
To: Michael Bauer; ckan-discuss at lists.okfn.org
Subject: Re: [ckan-discuss] CKAN - how to create a previously deleted group

Michael, 

The issue is that even though the group has been deleted, it is still in the database and there is a unique constraint on group names.  

There are two options that I can think of:

1. If you are using the latest version of the API, there is a new route for purging groups.  This should remove it from the database and get rid of the uniqueness issue.
http://docs.ckan.org/en/latest/api.html?highlight=group#ckan.logic.action.delete.group_purge

2.  If you know that you are never going to use that deleted group again, you could change the name of the group to eliminate the conflict.  You should be able to do this using the package_update route of the API. http://docs.ckan.org/en/latest/api.html?highlight=group#ckan.logic.action.update.package_update  If that doesn't work, you could write SQL to change the name of the group directly in the database, but I would not recommend this approach at all.  You really don't want to touch the db except via the API.  This case would be relatively simple, but in most cases, you could 'corrupt' the database.  There is definitely a good reason that there is an API.

David.

-----Original Message-----
From: ckan-discuss-bounces at lists.okfn.org [mailto:ckan-discuss-bounces at lists.okfn.org] On Behalf Of Michael Bauer
Sent: Wednesday, August 14, 2013 4:03 AM
To: ckan-discuss at lists.okfn.org
Subject: [ckan-discuss] CKAN - how to create a previously deleted group

From:

http://ask.schoolofdata.org/question/162/ckan-how-to-restore-a-previously-deleted-group/

I created a group, then deleted it, and now when I want to create it again I get the following error:

The form contains invalid entries:
Name: Group name already exists in database

Cheers,
  Michael


--
Data Diva | skype: mihi_tr | @mihi_tr
The Open Knowledge Foundation | School of Data http://okfn.org | http://schoolofdata.org GPG/PGP key: http://tentacleriot.eu/mihi.asc

_______________________________________________
ckan-discuss mailing list
ckan-discuss at lists.okfn.org
http://lists.okfn.org/mailman/listinfo/ckan-discuss
Unsubscribe: http://lists.okfn.org/mailman/options/ckan-discuss



_______________________________________________
ckan-discuss mailing list
ckan-discuss at lists.okfn.org
http://lists.okfn.org/mailman/listinfo/ckan-discuss
Unsubscribe: http://lists.okfn.org/mailman/options/ckan-discuss





More information about the ckan-discuss mailing list