Skip to main content

Tags

Tags are the primary way to organize assets in Dagster. You can attach several tags to an asset when it's defined, and they will appear in the UI. You can also use tags to search and filter for assets in the Asset catalog in Dagster+. They're structured as key-value pairs of strings.

Here's an example of some tags you might apply to an asset:

{"domain": "marketing", "pii": "true"}

Like owners, just pass a dictionary of tags to the tags argument when defining an asset:

import dagster as dg


# You can attach tags via the `tags` argument on the `@asset` decorator.
@dg.asset(tags={"domain": "marketing", "pii": "true"})
def my_asset(): ...


# You can also use `tags` with `AssetSpec`
my_external_asset = dg.AssetSpec(
"my_external_asset", tags={"domain": "legal", "sensitive": ""}
)

Keep in mind that tags must contain only strings as keys and values. Additionally, the Dagster UI will render tags with the empty string as a "label" rather than a key-value pair.

Tag keys

Valid tag keys have two segments: an optional prefix and name, separated by a slash (/). Prefixes are typically expected to be Python package names. For example: dagster/priority

Prefixes and name segments must each:

  • Be 63 characters or less
  • Contain only alphanumeric characters, dashes (-), underscores (_), and dots (.)

Tag values

Tag values must:

  • Be 63 characters or less
  • Contain only alphanumeric characters, dashes (-), underscores (_), and dots (.)
  • Be a string or JSON that is serializable to a string

Customizing run execution with tags

While tags are primarily used for labeling and organization, some run execution features are controlled using run tags:

System tags

Asset tags

The following table lists tags which Dagster may automatically add to assets.

TagDescription
dagster/kind/{kind}A tag identifying that an asset has a specific kind. For more information, see Kind tags

Run tags

The following table lists the tags Dagster will, on occasion, automatically add to runs.

TagDescription
dagster/op_selectionThe op selection for the run
dagster/partitionThe partition of the run
dagster/schedule_nameThe schedule that triggered the run
dagster/sensor_nameThe sensor that triggered the run
dagster/backfillThe backfill ID
dagster/parent_run_idThe parent run of a re-executed run
dagster/imageThe Docker image tag