Skip to main content

entity_tag_assignments

Creates, updates, deletes, gets or lists an entity_tag_assignments resource.

Overview

Nameentity_tag_assignments
TypeResource
Iddatabricks_workspace.catalog.entity_tag_assignments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
entity_namestringThe fully qualified name of the entity to which the tag is assigned
entity_typestringThe type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.
source_typestringThe source type of the tag assignment, e.g., user-assigned or system-assigned (TAG_ASSIGNMENT_SOURCE_TYPE_SYSTEM_DATA_CLASSIFICATION)
tag_keystringThe key of the tag
tag_valuestringThe value of the tag
update_timestring (date-time)The timestamp when the tag assignment was last updated
updated_bystringThe user or principal who updated the tag assignment

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectentity_type, entity_name, tag_key, deployment_nameGets a tag assignment for an Unity Catalog entity by tag key.
listselectentity_type, entity_name, deployment_namemax_results, page_tokenList tag assignments for an Unity Catalog entity
createinsertdeployment_name, tag_assignmentCreates a tag assignment for an Unity Catalog entity.
updateupdateentity_type, entity_name, tag_key, update_mask, deployment_name, tag_assignmentUpdates an existing tag assignment for an Unity Catalog entity.
deletedeleteentity_type, entity_name, tag_key, deployment_nameDeletes a tag assignment for an Unity Catalog entity by its key.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
entity_namestringThe fully qualified name of the entity to which the tag is assigned
entity_typestringThe type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.
tag_keystringRequired. The key of the tag to delete
update_maskstringThe field mask must be a single string, with multiple fields separated by commas (no spaces). The field path is relative to the resource object, using a dot (.) to navigate sub-fields (e.g., author.given_name). Specification of elements in sequence or map fields is not allowed, as only the entire collection field can be specified. Field names must exactly match the resource field names. A field mask of * indicates full replacement. It’s recommended to always explicitly list the fields being updated and avoid using * wildcards, as it can lead to unintended results if the API changes in the future.
max_resultsintegerOptional. Maximum number of tag assignments to return in a single page
page_tokenstringOptional. Pagination token to retrieve the next page of results

SELECT examples

Gets a tag assignment for an Unity Catalog entity by tag key.

SELECT
entity_name,
entity_type,
source_type,
tag_key,
tag_value,
update_time,
updated_by
FROM databricks_workspace.catalog.entity_tag_assignments
WHERE entity_type = '{{ entity_type }}' -- required
AND entity_name = '{{ entity_name }}' -- required
AND tag_key = '{{ tag_key }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Creates a tag assignment for an Unity Catalog entity.

INSERT INTO databricks_workspace.catalog.entity_tag_assignments (
tag_assignment,
deployment_name
)
SELECT
'{{ tag_assignment }}' /* required */,
'{{ deployment_name }}'
RETURNING
entity_name,
entity_type,
source_type,
tag_key,
tag_value,
update_time,
updated_by
;

UPDATE examples

Updates an existing tag assignment for an Unity Catalog entity.

UPDATE databricks_workspace.catalog.entity_tag_assignments
SET
tag_assignment = '{{ tag_assignment }}'
WHERE
entity_type = '{{ entity_type }}' --required
AND entity_name = '{{ entity_name }}' --required
AND tag_key = '{{ tag_key }}' --required
AND update_mask = '{{ update_mask }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND tag_assignment = '{{ tag_assignment }}' --required
RETURNING
entity_name,
entity_type,
source_type,
tag_key,
tag_value,
update_time,
updated_by;

DELETE examples

Deletes a tag assignment for an Unity Catalog entity by its key.

DELETE FROM databricks_workspace.catalog.entity_tag_assignments
WHERE entity_type = '{{ entity_type }}' --required
AND entity_name = '{{ entity_name }}' --required
AND tag_key = '{{ tag_key }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;