frb
frb

Reputation: 3798

CKAN: is it possible to automatically remove older data?

I'm using CKAN's DataStore and I'm wondering if it is possible to configure for automatic old data deletion. I mean, I would like something like:

  1. Establish the lifetime for records in the DataStore, in order CKAN automatically removes the records older than such a lifetime.
  2. Establish the size of the DataStore, in order CKAN automatically removes as many records as needed upon new records upsert.

I've seen the resource_create operation of the API has an optional size parameter, but I don't if it is related with my question.

Upvotes: 0

Views: 108

Answers (1)

Matt Fullerton
Matt Fullerton

Reputation: 535

I know of no CKAN support for this feature. I think the best quick approach here is to add a trigger in Postgres that keeps the table(s) for the resources that size, or just deletes "old" records. This might be a good starting point (from 2. onwards): http://www.the-art-of-web.com/sql/trigger-delete-old/

I've used a trigger in a CKAN datastore DB to timestamp records that are coming in and the approach works well (albeit completely intransparent/uneditable for the CKAN user).

Upvotes: 1

Related Questions