[ckan-dev] Empty datastore table in CKAN
Vitor Baptista
vitor at vitorbaptista.com
Wed Feb 24 13:13:04 UTC 2016
(As answered in stackoverflow
<http://stackoverflow.com/questions/35598133/delete-all-records-with-id-higher-than-x-in-ckan/35603168#35603168>
)
To delete a datastore table's contents without deleting its structure, you
simply call "datastore_delete" without passing any "filters".
On 24 February 2016 at 12:41, Michael Nielsen <mic.niel84 at gmail.com> wrote:
> 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".
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
--
Vítor Baptista
http://vitorbaptista.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160224/60d799ad/attachment-0003.html>
More information about the ckan-dev
mailing list