Deleting all datasets in a container when performing a hard-delete action

Original Slack Thread

Hello team,
I’m using DataHub v0.12.1
Is there any way to delete all of datasets in container ABC when do hard-delete specific container ABC?
When I tested http://rest.li|rest.li api like below, container was deleted but all of datasets were not deleted…
curl "<http://localhost:8082/entities?action=delete>" -X POST --data '{"urn": "urn:li:container:ABC"}'

Hey there! :wave: Make sure your message includes the following information if relevant, so we can help more effectively!

  1. Which DataHub version are you using? (e.g. 0.12.0)
  2. Please post any relevant error logs on the thread!

im not sure myself, but i dont think it is possible because there is no way to assign null`` once a dataset has the container` aspect

or at least, it is a behavior observed between 0.8.45 and 0.10.3, not sure about the newer versions

I recently had the same issue. I took the container urn and used datahub cli to clean it up.
Something like this:
datahub delete --query "urn:li:container:34f6742c12006e88d7bec6eec12a2024" -n
Make sure it will delete only the intended data and then run
datahub delete --query "urn:li:container:34f6742c12006e88d7bec6eec12a2024" --hard
You can use --help at the end to see the options you have.

sorry i misread the qn, i thought you were trying to remove the orphaned reference

I checked the above command is working well! --query option can delete unintended datasets easily. Thank you all :smile: