docs/api/tutorials/subscriptions.md
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Subscriptions are a way to receive notifications when entity changes occur (e.g. deprecations, schema changes, ownership changes, etc.) or when assertions change state (pass, fail, or error). Subscriptions can be created at the dataset level (affecting any changes on the dataset, as well as all assertions on the dataset) or at the assertion level (affecting only specific assertions).
This guide specifically covers how to use the DataHub Cloud Python SDK for managing Subscriptions:
pip install acryl-datahub-cloud)Manage User Subscriptions privilege for the datasets at hand.:::note Before creating subscriptions, you need to ensure the target datasets and groups are already present in your DataHub instance. If you attempt to create subscriptions for entities that do not exist, GMS will continuously report errors to the logs. :::
You can create subscriptions to receive notifications when assertions change state (pass, fail, or error) or when other entity changes occur. Subscriptions can be created at the dataset level (affecting any changes on the dataset, as well as all assertions on the dataset) or at the assertion level (affecting only specific assertions).
<Tabs> <TabItem value="python" label="Python">{{ inline /metadata-ingestion/examples/library/subscription_create.py show_path_as_comment }}
You can remove existing subscriptions to stop receiving notifications. The unsubscribe method supports selective removal of specific change types or complete removal of subscriptions.
<Tabs> <TabItem value="python" label="Python">{{ inline /metadata-ingestion/examples/library/subscription_remove.py show_path_as_comment }}
The following change types are available for subscriptions:
OPERATION_COLUMN_ADDED - When a new column is added to a datasetOPERATION_COLUMN_REMOVED - When a column is removed from a datasetOPERATION_COLUMN_MODIFIED - When an existing column is modifiedOPERATION_ROWS_INSERTED - When rows are inserted into a datasetOPERATION_ROWS_UPDATED - When rows are updated in a datasetOPERATION_ROWS_REMOVED - When rows are removed from a datasetASSERTION_PASSED - When an assertion run passesASSERTION_FAILED - When an assertion run failsASSERTION_ERROR - When an assertion run encounters an errorINCIDENT_RAISED - When a new incident is raisedINCIDENT_RESOLVED - When an incident is resolvedTEST_PASSED - When a test passesTEST_FAILED - When a test failsDEPRECATED - When an entity is marked as deprecatedUNDEPRECATED - When an entity's deprecation status is removedINGESTION_SUCCEEDED - When ingestion completes successfullyINGESTION_FAILED - When ingestion failsDOCUMENTATION_CHANGE - When documentation is modifiedOWNER_ADDED - When an owner is added to an entityOWNER_REMOVED - When an owner is removed from an entityGLOSSARY_TERM_ADDED - When a glossary term is added to an entityGLOSSARY_TERM_REMOVED - When a glossary term is removed from an entityGLOSSARY_TERM_PROPOSED - When a glossary term is proposed for an entityTAG_ADDED - When a tag is added to an entityTAG_REMOVED - When a tag is removed from an entityTAG_PROPOSED - When a tag is proposed for an entity