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

Alexis Manuel

02/22/2023, 2:43 PM
Hi everyone, I did not find anything related to my problem so here I am. I want to create an asset sensor for an asset loaded from my dbt project which waits for its upstream Fivetran dependency to materialize. Given my dbt asset key, I can not figure out how to obtain the upstream asset key I need for the asset sensor declaration. So far I was messing with the AssetSelection class and managed to obtain the upstream (
AssetSelection.keys(AssetKey([prefix, name])).upstream()
) but I can not find how to get the corresponding asset keys. Thanks for your help 🙏
c

claire

02/22/2023, 9:44 PM
Hi Alexis. If you're using a
multi_asset_sensor
, you can directly pass in an
AssetSelection
like this:
multi_asset_sensor(monitored_assets=AssetSelection(...)
If you're using an
@asset_sensor
, you will have to resolve your asset selection by doing something like:
Copy code
@asset_sensor(asset_key=AssetSelection(...).resolve(defs.get_repository_def().asset_graph)[0])
Though ideally we allow you to pass in an asset selection into that argument as well
a

Alexis Manuel

02/23/2023, 8:12 AM
Thank you @claire for your help !
2 Views