Tony Wren
06/22/2023, 10:23 AMfrom dagster import asset, AssetIn
@asset
def list_of_friends():
return ["johnny", "sara", "abdul"]
@asset
def list_of_pets():
return ["lassie", "laika"]
@asset(ins={"upstream": AssetIn(key=["list_of_friends", "list_of_pets"])})
def number_of_animals_and_friends(upstream):
print("This doesn't even work")
#print(f"there are {len(list_of_friends)+len(list_of_pets)} number of friends!")
This doesn't work and I get the following error:
dagster._core.errors.DagsterInvalidDefinitionError: Input asset '["list_of_friends", "list_of_pets"]' for asset '["number_of_animals_and_friends"]' is not produced by any of the provided asset ops and is not one of the provided sources
Removing the decorator parameters in the last function works.
@asset
def number_of_animals_and_friends(list_of_friends, list_of_pets):
print(f"there are {len(list_of_friends)+len(list_of_pets)} number of friends!")
How do I get this to work with the explicitly typed asset dependencies? What am I missing?Drew You
06/22/2023, 2:32 PM@asset(ins={"upstream": AssetIn(key=["list_of_friends", "list_of_pets"])})
def number_of_animals_and_friends(upstream):
print("This doesn't even work")
#print(f"there are {len(list_of_friends)+len(list_of_pets)} number of friends!")
Here, key=["list_of_friends", "list_of_pets"]
tells dagster to look for the asset with key list_of_friends/list_of_pets
. I think you actually want,
@asset(ins={
"friends": AssetIn(key=["list_of_friends"]),
"pets": AssetIn(key=["list_of_pets"])
})