Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a resource is deleted, the corresponding data in the DataStore should be deleted as well #3422

Closed
metaodi opened this issue Jan 31, 2017 · 10 comments
Assignees

Comments

@metaodi
Copy link
Member

metaodi commented Jan 31, 2017

CKAN Version if known (or site URL)

2.5.3

Please describe the expected behaviour

If a resource is deleted, the corresponding data in the DataStore should be deleted as well. Otherwise the DataStore will quickly overflow if you harvest a big source and for each resource a new table is created and the old one still in place.

Please describe the actual behaviour

Currently the deletion of a ressource does not affect the DataStore at all. But every table in the DataStore is linked to a resource in CKAN, so it's safe to assume they share the same lifecycle.

What steps can be taken to reproduce the issue?

  1. Create a resource in CKAN (with DataStore enabled)
  2. Upload a CSV & upload to DataStore
  3. Delete the resource in CKAN

The resource is still available in the DataStore

@amercader
Copy link
Member

@metaodi You are of course absolutely correct. @smotornyuk will have a go at implementing this. It would be great if you could test this once there is a PR/

@wardi
Copy link
Contributor

wardi commented Jan 31, 2017

We could also use a command for cleaning out orphaned datastore tables

@metaodi
Copy link
Member Author

metaodi commented Jan 31, 2017

@wardi maybe additionally, to cleanup "old" databases. But I think to have this implemented properly makes sense, doesn't it?

@wardi
Copy link
Contributor

wardi commented Jan 31, 2017

Absolutely! (that's why I used the word "also")

@jqnatividad
Copy link
Contributor

+1 to having a CLI command to clean orphaned datastore tables.

@metaodi
Copy link
Member Author

metaodi commented Feb 8, 2017

I created a "quick & dirty" paster command to empty the orphaned tables, which saves us a lot of space on our DB server: opendata-swiss/ckanext-switzerland#137

It does not drop the tables, but simply calls the datastore_delete API. It's good enough for now for us.

cc @wardi @jqnatividad

@amercader
Copy link
Member

Fixed in #3425

@jqnatividad
Copy link
Contributor

Any chance the "quick & dirty" paster command to clean up orphaned datastore tables that @metaodi put together will be folded into core?

@metaodi
Copy link
Member Author

metaodi commented Jun 18, 2018

@jqnatividad if there is a need, I can create a PR with the command for this repository.

@joeldouglass
Copy link

This appears to be fixed if you directly delete a resource. But if you delete and purge a data set (which also deletes its resources), the datastore tables are still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants