How to automatically trigger the materialization o...
# ask-ai
How to automatically trigger the materialization of an asset when its upstream dependency has been materialized
To automatically trigger the materialization of an asset when its upstream dependency has been materialized, you can use an
. This policy consists of a set of
, each representing individual reasons that an asset should be materialized or not at a given point in time. Here's how you can set it up: 1. Enable Auto-Materialization: First, ensure that auto-materialization is enabled in your Dagster deployment. In the Dagster UI, you can find a toggle under "Deployment" > "Daemons" for open source deployments, or under "Deployment" > "Agents" > "Cloud service statuses" for Dagster Cloud. 2. Define the Policy: Assign an
to your asset. You can start with the built-in
and customize it if necessary. This policy includes all supported rules except
. 3. Apply the Policy: Apply the
to your asset definition. If there's at least one rule determining that the asset should be materialized, and no rules determining that it should be skipped, a run will be launched to materialize that asset. Here's an example of how you might define an asset with an auto-materialization policy:
Copy code
python from dagster import asset, AutoMaterializePolicy  @asset(auto_materialize_policy=AutoMaterializePolicy.eager()) def my_asset(upstream_asset):     # Your asset computation logic here     pass
In this example,
will be automatically materialized when its upstream dependency
has been materialized, as per the eager policy. Remember that the
can be customized with different rules to fit your specific use case. For more detailed information and examples, you should refer to the [Auto-Materializing Assets documentation](