dagster icon indicating copy to clipboard operation
dagster copied to clipboard

`load_asset_checks_from_module` sometimes returns `AssetsDefinition`s instead of `AssetChecksDefinition`s

Open sryza opened this issue 9 months ago • 0 comments

To reproduce:

from dagster import AssetChecksDefinition, asset_check, load_asset_checks_from_current_module


@asset_check(asset="asset1")
def check1(): ...


assert isinstance(check1, AssetChecksDefinition)

asset_checks = load_asset_checks_from_current_module(asset_key_prefix=["prefix1"])
assert isinstance(asset_checks[0], AssetChecksDefinition)

This is because load_asset_checks_from_current_module calls _checks_with_attributes , which calls prefix_assets, which calls AssetChecksDefinition.with_attributes, which returns an AssetsDefinition, not an AssetChecksDefinition

sryza avatar May 23 '24 17:05 sryza