How to run an asset check after an AssetObservation, without an AssetMaterialization? #27151
-
I have an asset where an AssetObservation is done in every successful run, but an AssetMaterialization is done (for example) every 4th successful run. By default it seems asset check will only run in the same run automatically when an AssetMaterialization is emitted but I would like to run an asset check after an AssetObservation is emitted. Can this be done? How? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Answering myself - after some initial testing, it seems the way to achieve this is to pass This is also documented in Dagster docs https://docs.dagster.io/concepts/assets/asset-checks/define-execute-asset-checks#defining-checks-and-assets-together I was so used to the "separate definitions" approcah that this didn't even occur to me. |
Beta Was this translation helpful? Give feedback.
Answering myself - after some initial testing, it seems the way to achieve this is to pass
AssetCheckSpec
to@asset
decorator parametercheck_specs
, and then theAssetCheckResult
can be yielded inside the decorated function.This is also documented in Dagster docs https://docs.dagster.io/concepts/assets/asset-checks/define-execute-asset-checks#defining-checks-and-assets-together
I was so used to the "separate definitions" approcah that this didn't even occur to me.