https://dagster.io/ logo
Title
r

Rafael Gomes

10/27/2022, 1:28 AM
I would like to set
io_manager_key
and
metadata
after creating an asset from graph. Example:
my_asset = AssetsDefinition.from_graph(my_graph)
How do I set
io_manager_key
and
metadata
on
my_asset
?
:dagster-bot-responded-by-community: 1
v

Vinnie

10/27/2022, 7:25 AM
You can pass
metadata_by_output_name
to the
from_graph
method (https://docs.dagster.io/_apidocs/assets#dagster.AssetsDefinition.from_graph) but as far as I know there isn’t a way to set the IO manager. My workaround is to set it on the
op
that leads to the result, e.g.
@op(out=Out(my_cool_type, io_manager_key="my_cool_io_manager"),)
def my_cool_op(data):
    return do_something_cool(data)

@graph
def my_cool_graph():
    data = ...
    return my_cool_op(data)