Area: Product
Sub-Area: Data Management
Applies to: OSS + Cloud
Issue
You marked a dataset as deprecated or deleted it, and the result is not what you expected. For example, the dataset is missing from search when you only wanted to deprecate it, or it is still in DataHub after you ran a delete.
You Might Be Asking
- How do I mark a dataset as deprecated?
- What is the difference between deprecating and soft deleting a dataset?
- Why did my datasets disappear after an ingestion run?
- How do I permanently delete a dataset?
Cause
Deprecation and soft delete are two different things stored in two different aspects.
-
Deprecation is the
deprecationaspect. You set it withupdateDeprecation. -
Soft delete is the
statusaspect withremoved=true. WhenincludeSoftDeletedis false, search excludes soft-deleted entities. - Hard delete permanently removes the entity's rows from the database. You can't undo it.
datahub delete does a soft delete unless you add --hard. So a plain datahub delete --urn ... leaves the entity in DataHub.
Stateful ingestion's stale entity removal writes a soft delete (status with removed=true) and nothing else. If datasets vanish from search after an ingestion run, check for a soft delete, not a change to deprecation.
Solution
- Mark a dataset as deprecated with GraphQL. You need the "Edit Deprecation" privilege.
mutation updateDeprecation {
updateDeprecation(
input: {
urn: "urn:li:dataset:(urn:li:dataPlatform:snowflake,db.schema.table,PROD)"
deprecated: true
note: "This table is deprecated. Use analytics.new_table instead."
decommissionTime: 1735689600000
}
)
}
decommissionTime is a Long. To deprecate many assets at once, use batchUpdateDeprecation. See Deprecation API.
-
Set deprecation with the Python SDK.
emit_mcptakes one argument, aMetadataChangeProposalWrapper. It does not acceptentity_urn,aspect_nameoraspectkeyword arguments. Build the wrapper withMetadataChangeProposalWrapper(entityUrn=..., aspect=DeprecationClass(...)), then callemitter.emit(mcpw)oremitter.emit_mcp(mcpw). -
To filter search results on deprecation, use
orFilters. Thefiltersinput is deprecated. Each filter hasfield,values,negatedandcondition. -
Find out why a dataset disappeared. If stale entity removal soft deleted it, the
statusaspect hasremoved=true. Stale entity removal only writes thestatusaspect (removed=true). It does not set or clear deprecation, so a dataset that was deprecated before it was soft deleted stays deprecated. To restore soft-deleted entities, usedatahub delete undo-by-filter. -
Delete a dataset with the CLI.
# Soft delete (default). Sets status removed=true. The entity stays in DataHub.
datahub delete --urn "urn:li:dataset:(urn:li:dataPlatform:snowflake,db.schema.table,PROD)"
# Hard delete. Permanently removes the entity's rows from the database.
datahub delete --urn "urn:li:dataset:(urn:li:dataPlatform:snowflake,db.schema.table,PROD)" --hard
Soft deletion can be undone. Hard deletion can't. Without --force, a hard delete asks you to confirm. The prompt warns that hard deletion permanently deletes data and can significantly slow down your instance while it runs, and recommends soft deletes instead.
In Python, DataHubGraph.hard_delete_entity(urn) or delete_entity(urn, hard=True) hard deletes. delete_entity(urn) soft deletes by default. See Deleting Metadata.
- Recipes:
transformersis a top-level key next tosourceandsink. It is not valid insidesource.config.
Related Documentation
Tags: deprecation, soft-delete, hard-delete, dataset-lifecycle, data-management, decommission, status