@asset decorator is used to define a software-defined asset - a combination of an asset key, a compute function, and upstream dependencies.
Signature
Parameters
The name of the asset. If not provided, defaults to the name of the decorated function. Must be a valid Dagster name (only contains letters, numbers, and underscore).
If provided, the asset’s key is the concatenation of the key_prefix and the asset’s name. Each item must be a valid Dagster name.
A dictionary that maps input names to information about the input.
The assets that are upstream dependencies, but do not correspond to a parameter of the decorated function. Can include
AssetDep, AssetsDefinition, SourceAsset, AssetKey, or str.A dict of metadata entries for the asset.
Tags for filtering and organizing. These tags are not attached to runs of the asset.
A human-readable description of the asset.
The configuration schema for the asset’s underlying op. If set, Dagster will check that config provided matches this schema.
Set of resource handles required by the op.
A mapping of resource keys to resources. These resources will be initialized during execution and can be accessed from the context.
A set of hooks to attach to the asset. These hooks will be executed when the asset is materialized.
The IOManager used for storing the output of the op as an asset. Only one of
io_manager_def and io_manager_key can be provided.The resource key of the IOManager used for storing the output. Defaults to “io_manager”.
Allows specifying type validation functions that will be executed on the output after it runs.
Defines the set of partition keys that compose the asset.
A dictionary of tags for the op that computes the asset. Values that are not strings will be JSON encoded.
A string name used to organize multiple assets into groups. If not provided, defaults to “default”.
Whether the decorated function will always materialize an asset. If False, the function can conditionally not yield a result.
A condition describing when Dagster should materialize this asset.
Configure Dagster to backfill this asset according to its BackfillPolicy.
The retry policy for the op that computes the asset.
Version of the code that generates this asset. Should be set only for code that deterministically produces the same output when given the same inputs.
The key for this asset. If provided, cannot specify key_prefix or name.
Specs for asset checks that execute in the decorated function after materializing the asset.
A list of strings representing owners of the asset. Each string can be a user’s email address, or a team name prefixed with
team:, e.g. team:finops.A list of strings representing the kinds of the asset. These will be made visible in the Dagster UI.
A string that identifies the concurrency pool that governs this asset’s execution.
Returns
Type:AssetsDefinition
An assets definition object representing the software-defined asset.
Examples
Basic Asset
Asset with Dependencies
Asset with Non-Argument Dependencies
Asset with Configuration
Conditional Asset Materialization
Asset with Metadata and Tags
Partitioned Asset
Related
- Partitions - Define partitions for assets
- Resources - Configure external services
- Jobs - Create executable jobs
