[ckan-dev] How to maintain the database?

Stefan Oderbolz stefan.oderbolz at liip.ch
Mon Dec 4 08:01:03 UTC 2017


Hi Martin,

we created such a "delete" command in our own extensions, maybe this is
what you're looking for:
https://github.com/opendata-swiss/ckanext-switzerland/blob/8199d96f5f313b5c5f5d2e35fd584b0ba6ef5a1c/ckanext/switzerland/commands.py#L39-L105

It basically checks if a table in the datastore belongs to an existing
resource, and if not, it calls `datastore_delete` on it, so make space.
We run this command with a cronjob every night, as we get a lot of
"orphaned" tables when harvesting.

- Stefan

On Fri, Dec 1, 2017 at 7:14 PM, Martin Szyszlican <MSzyszlican at jus.gob.ar>
wrote:

> We sometimes re-upload datasets after a failed or incomplete datapusher
> run, and we would like to delete everything unused from the database. We
> have reached a point where the DB is too big, and it´s slowing down the
> server, which makes the datapusher crashes more frequent.
>
>
>
> I know I can call resource.purge or datastore_delete on a single resource,
> but how do I detect everything that is deletable? Is there a maintenance
> command already created for this?
>
>
>
> *Martín Szyszlican*
> Programa Justicia Abierta | Secretaría de Planificación Estratégica
> *mszyszlican at jus.gob.ar <mszyszlican at jus.gob.ar>*
> (011) 5300-4000 int. 76067
>
> [image: logo_minjus]
>
>
>
>
>
> _______________________________________________
> 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
>
>


-- 
Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20171204/8dad7a1b/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 12218 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20171204/8dad7a1b/attachment-0003.png>


More information about the ckan-dev mailing list