# ask-ai

Brendan Jackson

02/12/2024, 11:22 PM
Can an asset check depend upon an asset, or a partition of an asset?


02/12/2024, 11:22 PM
Yes, an asset check can depend upon an asset or a partition of an asset. According to the documentation, the
is often used as an argument to decorators that decorate a function that can execute multiple checks, such as
. It defines one of the checks that will be executed inside that function. The
parameter within
allows you to specify additional dependencies for the check. These dependencies indicate that the check relies on these assets in some way, but the result of the check only applies to the asset specified by the
parameter. This means that an asset check can be written to test that an asset has matching data with an asset in
, which could be a partition of an asset. Furthermore, the documentation mentions that when loading a dbt project into the asset graph, Dagster’s dbt integration can load all dbt tests as Asset Checks, which makes it easier to visualize the success and failure of those tests as they now show up on the Dagster asset that corresponds to the dbt models they’re checking. This implies that asset checks can be associated with specific assets or partitions that are being tested. However, it's important to note that while you can write a check against a partitioned asset, as of a certain version of Dagster, per-partition checks were not supported. Instead, you would need to summarize the state of all partitions into one pass/fail for the asset. There is an example in the documentation showing how to write a check on a partitioned asset by summarizing the state of all partitions. This may have changed in more recent versions, so it's always a good idea to check the latest documentation or release notes for updates on this functionality.