Open AlexDo1 opened 3 years ago
I think this should be rather easy. There are different approaches how we can delete data, i.e.: https://docs.sqlalchemy.org/en/14/tutorial/orm_data_manipulation.html#orm-enabled-delete-statements
or simply adding Model instances to the session's session.delete
method. Nevertheless, there are different things we need to take care of:
cascade='all, delete'
or cascade='all, delete-orphan'
(https://docs.sqlalchemy.org/en/14/orm/cascades.html) for each relation defined with relationship
function to pass down the delete to other tables, where data should be deleted as well. The cascade has to be removed in case a cascade delete is not what we want (i.e. license)The functionality to delete entries would still be useful, I can work on that if you think the same @mmaelicke.
Yeah that would be great. There are some dependencies on a entry. Not all of them can be solved by CASCADE statements, which should be added to the sqlalchemy models.
And maybe we do not delete, but archive data (and metadata). So mark as deleted to exclude from future queries. The delete logic would then only delete, if the entry was already marked as deleted. This would make recoveries possible.
A function to remove an entry from metacatalog with all its traces and relationships (datasource, data, details, ...) would be very handy.
It is up for discussion what should be deleted and what should be kept in metacatalog (like author, variable, keywords, license, EntryGroup).