@materialize
decorator, you can track when your workflows create, update, or reference these objects.
Basic asset materialization
Use the@materialize
decorator to mark functions that create or update assets. This decorator wraps your function similar to @task
but specifically tracks asset creation:
s3://
assets are grouped separately from postgres://
assets, and nested paths like s3://bucket/team-a/data.csv
and s3://bucket/team-b/data.csv
create hierarchical organization.
@materialize
wraps @task
: the @materialize
decorator accepts all keyword arguments and configuration that the @task
decorator accepts and can be used as a drop-in replacement.Asset dependencies
Inferred from task graphs
Prefect automatically infers asset dependencies from your task graph. When materialized assets flow through your workflow, downstream materializations inherit these dependencies:
External and cross-flow asset dependencies
Useasset_deps
to reference assets that are external to your current workflow. This creates dependencies on assets that may be materialized by other flows, external systems, or manual processes:

Multiple asset materialization
Materialize multiple related assets in a single function when they share the same upstream dependencies:Dynamic asset materialization
Use thewith_options
pattern to dynamically change asset keys and dependencies at runtime. This is useful when you need to parameterize asset paths based on flow inputs, dates, or other runtime conditions: