I would like all downstream assets to be marked as...
# ask-ai
a
I would like all downstream assets to be marked as outdated once an upstream asset is materialized so that I know that I need to re-materialize them to get them up to date. How can I do this? Can I use a auto materialization policy to automatically trigger out-of-date assets?
s
Yes, you can use auto materialization policies (AMPs) to automatically trigger the materialization of downstream assets when an upstream asset is materialized. Dagster provides eager
AutoMaterializePolicys
, which allow materializing an asset whenever its parent assets are materialized. This feature is currently marked experimental, and some of the APIs may change in the future. Here is an example from the documentation on how to use an eager auto materialization policy:
Copy code
python from dagster import AutoMaterializePolicy, asset  @asset def asset1():     ...  @asset(auto_materialize_policy=AutoMaterializePolicy.eager(), deps=[asset1]) def asset2():     ...
In this example,
asset2
is downstream of
asset1
, and with the eager
AutoMaterializePolicy
,
asset2
will be materialized every time
asset1
is materialized. To learn more about auto-materializing assets, you can visit the [Concept page](https://docs.dagster.io/concepts/assets/asset-auto-execution) on auto-materialization in the documentation.