Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smart/Quick way to delete "one shot" all dataset of an organization?

Tags:

ckan

Is there a smart/quick way to permanently delete (“purge”) "one shot" all dataset belonging to an organization, either via GUI or via sysadmin command?

I've an organization with 100k datasets ...

like image 408
Francesco Mangiacrapa Avatar asked Dec 11 '25 04:12

Francesco Mangiacrapa


1 Answers

In the web interface you can 'delete' an organization's datasets in large batches and then 'empty the trash' to purge them. However with so many datasets this approach may suffer from request timeouts - let us know how you get on.

As an admin for the organization:

  • on the organization's page click "Manage" button
  • click "Datasets" tab
  • in the header row of the table tick the checkbox to select all the datasets on the page (the code suggests the paging allows you to do 500 at a time, but I've not checked for real)
  • click "Delete"

Then as a sysadmin:

  • In the top bar click "Sysadmin settings" (hammer icon)
  • click "trash" tab
  • click "Purge"

Alternatively you could write a script to call CKAN APIs:

  • package_search for fq=organization:<name> (rather than using organization_show, which is limited to 1000 datasets)
  • dataset_purge for each dataset
like image 67
D Read Avatar answered Dec 15 '25 12:12

D Read



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!