Another one while I'm here: I have an op that happ...
# ask-community
n
Another one while I'm here: I have an op that happens happens to populate two tables, so I'm trying to use a
graph_multi_asset
to feed the same output to different downstream assets. However, in Dagit it only shows one of the outputs and the other disappears since, I suppose, it's the same object being repeated twice. How can I make this one asset be upstream of two different assets with different key_prefixes?
Copy code
@op
def give_1():
    return 1

@graph_multi_asset(
    outs={
        "first": AssetOut(key_prefix=["test", "a"]),
        "second": AssetOut(key_prefix=["test", "b"])
    }
)
def test_multi_asset_simple():
    output = give_1()
    output2 = output
    return {"first": output, "second": output2}
The context here: I have a single databricks job that produces two tables. I have dbt that has two sources, one for each of these tables, which then feed to different downstream tables. How do I hook this databricks op to the two sources? I know how to do it for a single asset with the appropriate key prefixes, and I thought it would be a simple thing to say convert it to a multi-asset graph, but that's not the case since only one output appears
Right now, one dbt source gets hooked up properly while the other just hangs there without a definition or asset 😞
c
Hi Neil, I think this is a bug. I was able to reproduce this and I agree it's odd that the graph seems to only have one output if the output object is the same. Would you mind filing an issue for this? One workaround in the meantime would be to have an intermediate op that does nothing, i.e.:
Copy code
@op
def noop(give_1):
    return give_1


@graph_multi_asset(
    outs={"first": AssetOut(key_prefix=["test", "a"]), "second": AssetOut(key_prefix=["test", "b"])}
)
def test_multi_asset_simple():
    output = give_1()
    return {"first": output, "second": noop(output)}
Then you'll be able to see two assets as desired
n
Sure, what's the best way to file a bug report? I'll file an issue on Github