call API to soft delete in datahub
Hey there! 
<@U06TM7M40RK> Can you help with the questions in this thread?
Please continue to tag RunLLM (e.g <@U06TM7M40RK>) to have it continue generating responses!
To perform a soft delete in DataHub using an API, you can use the DataHub REST API to update the “Status” aspect of an entity to mark it as removed. This process involves sending a POST request to the DataHub server with the appropriate payload.
Here’s a step-by-step guide on how to do this:
-
Identify the URN: Determine the URN of the entity you want to soft delete. The URN is a unique identifier for the entity in DataHub.
-
Use the REST API: Send a POST request to the DataHub server to update the “Status” aspect of the entity. This will mark the entity as removed, effectively performing a soft delete.
Here is an example of how to perform a soft delete using a curl command:
curl -X 'POST' \
'http://localhost:8080/openapi/v3/entity/dataset/urn%3Ali%3Adataset%3A(urn%3Ali%3AdataPlatform%3Ahive%2Cfct_users_deleted%2CPROD)/status?systemMetadata=false' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"value": {
"removed": true
}
}' | jq
In this example:
- Replace
urn%3Ali%3Adataset%3A(urn%3Ali%3AdataPlatform%3Ahive%2Cfct_users_deleted%2CPROD)
with the actual URN of the entity you want to soft delete. - The
removed
field is set totrue
to mark the entity as removed.
This command will update the status of the specified entity, making it non-discoverable via search or browse, but still viewable via a direct link.
Would you like more detailed information on any specific part of this process?
Sources:
- <https://github.com/datahub-project/datahub/blob/master/docs/how/delete-metadata.md|DataHub Delete Metadata Documentation>
- <https://datahubproject.io/docs/0.14.0/api/restli/restli-overview#soft-deleting-an-entity|Soft Deleting an Entity>
0 button
0 button
Hint: Mention @runllm in the thread for followups.
Hi, how did my answer work out for you? Need any more assistance? You can also tag <@U07FV3UHE4D> to let your fellow community members know you’re still looking for guidance.