[ckan-dev] Empty datastore table in CKAN

Michael Nielsen mic.niel84 at gmail.com
Wed Feb 24 12:41:12 UTC 2016


Question also asked at
http://stackoverflow.com/questions/35598133/delete-all-records-with-id-higher-than-x-in-ckan
.

I'm trying to use the datastore_api in CKAN (ckan.org) and want to delete
all records with an id higher than X - my goal is simply to delete ALL
records without deleting the table.

Docs:
http://docs.ckan.org/en/ckan-2.5.1/maintaining/datastore.html?highlight=filter#ckanext.datastore.logic.action.datastore_delete

Running the API with

'filters': {'_id': '0'}

does work, but setting

{'_id': '>0'}

or

{'_id': '*'} fails.

How can I empty a table in the datastore without deleting the table?

The SQL generated in CKAN is:

...9b89-7ab1c36c8e00" WHERE ("_id" = '*') ...

So it make sense why it fails, but I don't know how to use the API calls
with either wildcards or "higher than".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160224/97d519fd/attachment-0002.html>


More information about the ckan-dev mailing list