Hey everyone. Is there any documentation available...
# ask-community
n
Hey everyone. Is there any documentation available regarding metadata in multi-asset outputs?
Copy code
@multi_asset(outs={"b": AssetOut(), "c": AssetOut()})
def example_op(a: pd.DataFrame) -> Output[Tuple[pd.DataFrame, pd.DataFrame]]:
    b, c = split_into_two_dfs(a)
    return Output(
        (b, c),
        metadata={
            "num_rows_b": b.shape[0],
            "num_rows_c": c.shape[0],
        },
    )
The code above yields the following error:
Copy code
dagster._core.errors.DagsterInvariantViolationError: Expected Tuple annotation for multiple outputs, but received non-tuple annotation.
Not sure what I am missing and would very much appreciate any feedback. Thanks in advance!
dagster bot responded by community 1
🤖 1
z
I think the error is indicating that it's expecting the return type of the multi-asset to be a tuple of outputs. I would try something like:
Copy code
@multi_asset(outs={"b": AssetOut(), "c": AssetOut()})
def example_op(a: pd.DataFrame) -> Tuple[Output[pd.DataFrame], Output[pd.DataFrame]]:
    b, c = split_into_two_dfs(a)
    return Output(b,metadata={"num_rows_b": b.shape[0]}), Output(c, metadata={"num_rows_c": c.shape[0],})
👍 1
n
Thank you @Zach! That is indeed what I was looking for.