-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Deletion of resource before purging #4867
Conversation
Hi @iamarnavgarg, thanks for submitting this. I'm not clear how this code helps with the original issue flagged in #4705. IIUC that issue states that if a dataset and its resources are purged, the actual data files hosted on the FileStore and the data tables hosted on the DataStore should be deleted as well. But I don't see how your code implements that, although I might be missing something. Do you mind expand on the changes? |
Hi @amercader, please find the below explanation regarding the changes: c)Thus, from the package ID, I delete the resource associated with the datasets. By doing this, the resource is first deleted and then we could perform the purging of the datasets. d) After the resource has been completely deleted from the datastore and package is also updated. We can perform the normal flow/execution of purging of the dataset. |
Fixes #4705 @dassolkim is concerned that IResourceController.before_delete event is not firing at any point when a dataset is deleted and then purged (either with package_purge or the admin.Trash page). PR #4867 seeks to implement the event in the admin.Trash page. But this PR proposes the alternative, which is to actually delete the resource when the dataset is deleted and fire the event then. It seems an anomaly that we don't delete resources with the dataset. It makes sense that the dataset and resources are both state=deleted. However there is an argument that we shouldn't, because a sysadmin can still see the deleted dataset, but with this PR it will have no resources.
@amercader |
Fixes #4705
Proposed fixes:
While purging of the dataset, the resources associated with them are deleted first and then the dataset.
The procedure followed is as below:
a)We need to have/retrieve the package id.
b) Using the package id,we will then retrieve the list of resources associated the dataset.
c) Now, we will delete the resources associated with the datasets.
d)Now,when the resources are deleted, the flow of purging will resume its normal flow afterwards.