Skip to main content

entity-tag-assignments command group

note

This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

The entity-tag-assignments command group within the Databricks CLI contains commands to create, update, delete, and list tag assignments across Unity Catalog entities. Tags are attributes that include keys and optional values that you can use to organize and categorize entities in Unity Catalog. See Apply tags to Unity Catalog securable objects.

databricks entity-tag-assignments create

Create a tag assignment for a Unity Catalog entity.

To add tags to Unity Catalog entities, you must own the entity or have the following privileges:

  • APPLY TAG on the entity
  • USE SCHEMA on the entity's parent schema
  • USE CATALOG on the entity's parent catalog

To add a governed tag to Unity Catalog entities, you must also have the ASSIGN or MANAGE permission on the tag policy. See Manage tag policy permissions.

databricks entity-tag-assignments create ENTITY_NAME TAG_KEY ENTITY_TYPE [flags]

Arguments

ENTITY_NAME

    The fully qualified name of the entity to which the tag is assigned.

TAG_KEY

    The key of the tag.

ENTITY_TYPE

    The type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.

Options

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

--tag-value string

    The value of the tag.

Global flags

Examples

The following example creates a tag assignment for a table:

Bash
databricks entity-tag-assignments create my_catalog.my_schema.my_table environment tables --tag-value production

The following example creates a tag assignment using JSON:

Bash
databricks entity-tag-assignments create my_catalog.my_schema.my_table department tables --json '{"tag_value": "finance"}'

databricks entity-tag-assignments delete

Delete a tag assignment for a Unity Catalog entity by its key.

To delete tags from Unity Catalog entities, you must own the entity or have the following privileges:

  • APPLY TAG on the entity
  • USE_SCHEMA on the entity's parent schema
  • USE_CATALOG on the entity's parent catalog

To delete a governed tag from Unity Catalog entities, you must also have the ASSIGN or MANAGE permission on the tag policy. See Manage tag policy permissions.

databricks entity-tag-assignments delete ENTITY_TYPE ENTITY_NAME TAG_KEY [flags]

Arguments

ENTITY_TYPE

    The type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.

ENTITY_NAME

    The fully qualified name of the entity to which the tag is assigned.

TAG_KEY

    The key of the tag to delete.

Options

Global flags

Examples

The following example deletes a tag assignment from a table:

Bash
databricks entity-tag-assignments delete tables my_catalog.my_schema.my_table environment

databricks entity-tag-assignments get

Get a tag assignment for a Unity Catalog entity by tag key.

databricks entity-tag-assignments get ENTITY_TYPE ENTITY_NAME TAG_KEY [flags]

Arguments

ENTITY_TYPE

    The type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.

ENTITY_NAME

    The fully qualified name of the entity to which the tag is assigned.

TAG_KEY

    The key of the tag.

Options

Global flags

Examples

The following example gets a tag assignment for a table:

Bash
databricks entity-tag-assignments get tables my_catalog.my_schema.my_table environment

databricks entity-tag-assignments list

List tag assignments for a Unity Catalog entity.

important

The API is by default paginated, a page may contain zero results while still providing a next_page_token. Clients must continue reading pages until next_page_token is absent, which is the only indication that the end of results has been reached.

databricks entity-tag-assignments list ENTITY_TYPE ENTITY_NAME [flags]

Arguments

ENTITY_TYPE

    The type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.

ENTITY_NAME

    The fully qualified name of the entity to which the tag is assigned.

Options

--max-results int

    Maximum number of results to return.

--page-token string

    Token to retrieve the next page of results.

Global flags

Examples

The following example lists all tag assignments for a table:

Bash
databricks entity-tag-assignments list tables my_catalog.my_schema.my_table

The following example lists tag assignments with pagination:

Bash
databricks entity-tag-assignments list tables my_catalog.my_schema.my_table --max-results 10

databricks entity-tag-assignments update

Update an existing tag assignment for a Unity Catalog entity.

To update tags to Unity Catalog entities, you must own the entity or have the following privileges:

  • APPLY TAG on the entity
  • USE SCHEMA on the entity's parent schema
  • USE CATALOG on the entity's parent catalog

To update a governed tag to Unity Catalog entities, you must also have the ASSIGN or MANAGE permission on the tag policy. See Manage tag policy permissions.

databricks entity-tag-assignments update ENTITY_TYPE ENTITY_NAME TAG_KEY UPDATE_MASK [flags]

Arguments

ENTITY_TYPE

    The type of the entity to which the tag is assigned. Allowed values are: catalogs, schemas, tables, columns, volumes.

ENTITY_NAME

    The fully qualified name of the entity to which the tag is assigned.

TAG_KEY

    The key of the tag.

UPDATE_MASK

    The 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.

    An asterisk (*) field mask 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.

Options

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

--tag-value string

    The value of the tag.

Global flags

Examples

The following example updates a tag assignment for a table:

Bash
databricks entity-tag-assignments update tables my_catalog.my_schema.my_table environment "tag_value" --tag-value staging

The following example updates a tag assignment using JSON:

Bash
databricks entity-tag-assignments update tables my_catalog.my_schema.my_table environment "tag_value" --json '{"tag_value": "development"}'

Global flags

--debug

  Whether to enable debug logging.

-h or --help

    Display help for the Databricks CLI or the related command group or the related command.

--log-file string

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

--log-format format

    The log format type, text or json. The default value is text.

--log-level string

    A string representing the log format level. If not specified then the log format level is disabled.

-o, --output type

    The command output type, text or json. The default value is text.

-p, --profile string

    The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.

--progress-format format

    The format to display progress logs: default, append, inplace, or json

-t, --target string

    If applicable, the bundle target to use