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

Expoze Dummy

02/19/2023, 6:06 PM
Hello! I made these two assets using the same graph of ops via this code:
Copy code
cleaned_data_bank_loan = AssetsDefinition.from_graph(clean_data_graph, key_prefix=["source", "bank_loan"])
cleaned_data_bank_marketing = AssetsDefinition.from_graph(clean_data_graph, key_prefix=["source", "bank_marketing"])
Is there in any way that I can modify the name of the asset? I only found a way of modifying the key_prefix but not the actual name. These two assets basically have the same logic of how they would materialize and as such, I created a graph and derived these two assets. Later on, I plan to supply it with arguments via run config to specify what's the location of the asset it's going to materialize.
c

claire

02/21/2023, 8:47 PM
Hi Ryan. You can specify a different output asset key for each
AssetsDefinition.from_graph
instance by doing something like this:
Copy code
AssetsDefinition.from_graph(my_graph, keys_by_output_name={"result": AssetKey("asset_1")}),
AssetsDefinition.from_graph(my_graph, keys_by_output_name={"result": AssetKey("asset_2")}),
Here
result
is the output name of the graph.
e

Expoze Dummy

03/02/2023, 12:51 AM
Thank you so much, claire. Can confirm that this works