I have a @multi_asset that produces a dataframe an...
# ask-community
c
I have a @multi_asset that produces a dataframe and a list. I want both of these to be supplied to a single downstream @asset. How can I do this? E.g. @multi_asset(outs={"out1": AssetOut(), "out2": AssetOut()}) def func(): return out1, out 2 @asset def downstream_func(out1, out2): I see examples in the docs of outputs from a @multi_asset being supplied to multiple individual @assets but can't find any examples for this scenario.
o
hi @Clayton Casey! the general shape you've shared above should work (basically, the downstream asset doesn't care whether its upstream assets come from a multi asset or two separate assets, so the syntax is the same) -- have you run into any issues doing that?
c
Is there a specific way to reference out1, and out2 in downstream_func() in this example? When I try to set it up like I did in the example then I am getting the "dagster._core.errors.DagsterInvalidDefinitionError: Input asset '["out1"]' for asset '["core", "downstream_func_"]' is not produced by any of the provided asset ops and is not one of the provided sources" Even though I am returning out1, and out2 in the @multi_asset
o
ah it seems like you have a key prefix for your assets, so you may need to be more explicit when providing your dependencies (by default, if you have an input
out1
, then it's assumed that corresponds to the exact asset key
AssetKey(['out1'])
). so if the output of your multi_asset actually has an asset key of
AssetKey(['foo_prefix', 'out1'])
, then you can indicate this with
Copy code
@asset(
    ins={"out1": AssetIn(key_prefix='foo_prefix'), ...}
)
def downstream_func(out1, out2):
    ...
c
My @multi_asset(outs={}) had a misspelling in this instance. Thanks for your help!
🌈 1