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

Chaitya

05/10/2023, 4:29 PM
Hey folks, is it possible for an asset to take on optional asset dependencies? For example, I've got an asset that aggregates over a set of other assets (if those other assets have been materialized). I want this asset to run after all of the others, but not force the execution of the other assets if the user hasn't included them in the materialize call.
dagster bot responded by community 1
🤖 1
for example:
Copy code
@asset
def asset1():
    return 1

@asset
def asset2():
    return 2

@asset
def my_asset(asset1: Optional, asset2: Optional):
    sum = 0
    if asset1:
        sum+=asset1
    if asset2:
        sum+=asset2
    return sum
g

Guy McCombe

05/10/2023, 4:47 PM
Maybe you could achieve this with MultiAssetSensors?
c

Chaitya

05/10/2023, 6:35 PM
Thanks for the pointer, will give it a shot!
2 Views