Hi everyone, I did not find anything related to my...
# ask-community
a
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
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
Thank you @claire for your help !