Modifying Deprecation
Why Would You Use Deprecation?
Deprecation indicates the status of an entity. For datasets, keeping the deprecation status up-to-date is important to inform users and downstream systems of changes to the dataset's availability or reliability. By updating the status, you can prevent issues and ensure users have access to the most reliable data.
Goal Of This Guide
This guide will show you how to read or update deprecation status of a dataset fct_users_created
.
Prerequisites
For this tutorial, you need to deploy DataHub Quickstart and ingest sample data. For detailed steps, please refer to Datahub Quickstart Guide.
Before updating deprecation, you need to ensure the targeted dataset is already present in your datahub. If you attempt to manipulate entities that do not exist, your operation will fail. In this guide, we will be using data from a sample ingestion.
Read Deprecation
- GraphQL
- Curl
- Python
query {
dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)") {
deprecation {
deprecated
decommissionTime
}
}
}
If you see the following response, the operation was successful:
{
"data": {
"dataset": {
"deprecation": {
"deprecated": false,
"decommissionTime": null
}
}
},
"extensions": {}
}
curl --location --request POST 'http://localhost:8080/api/graphql' \
--header 'Authorization: Bearer <my-access-token>' \
--header 'Content-Type: application/json' \
--data-raw '{ "query": "{ dataset(urn: \"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)\") { deprecation { deprecated decommissionTime } } }", "variables":{} }'
Expected Response:
{
"data": {
"dataset": {
"deprecation": { "deprecated": false, "decommissionTime": null }
}
},
"extensions": {}
}
Coming Soon!
Update Deprecation
- GraphQL
- Curl
- Python
mutation updateDeprecation {
updateDeprecation(input: { urn: "urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)", deprecated: true })
}
Also note that you can update deprecation status of multiple entities or subresource using batchUpdateDeprecation
.
mutation batchUpdateDeprecation {
batchUpdateDeprecation(
input: {
deprecated: true,
resources: [
{ resourceUrn:"urn:li:dataset:(urn:li:dataPlatform:hdfs,SampleHdfsDataset,PROD)"} ,
{ resourceUrn:"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)"} ,]
}
)
}
If you see the following response, the operation was successful:
{
"data": {
"updateDeprecation": true
},
"extensions": {}
}
curl --location --request POST 'http://localhost:8080/api/graphql' \
--header 'Authorization: Bearer <my-access-token>' \
--header 'Content-Type: application/json' \
--data-raw '{ "query": "mutation updateDeprecation { updateDeprecation(input: { deprecated: true, urn: \"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)\" }) }", "variables":{}}'
Expected Response:
{ "data": { "removeTag": true }, "extensions": {} }
Coming Soon!
Expected Outcomes of Updating Deprecation
You can now see the dataset fct_users_created
has been marked as Deprecated.