https://dagster.io/ logo
#ask-ai
Title
# ask-ai
a

Alex Berndt

02/27/2024, 10:01 PM
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

Scout

02/27/2024, 10:01 PM
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.
2 Views