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

Tony Wren

06/22/2023, 10:23 AM
Hey! I'm trying to construct a super-simple (?) example that defines an asset with multiple upstream dependencies that are explicitly set.
Copy code
from 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:
Copy code
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.
Copy code
@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?
dagster bot responded by community 1
d

Drew You

06/22/2023, 2:32 PM
Copy code
@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,
Copy code
@asset(ins={
"friends": AssetIn(key=["list_of_friends"]),
"pets": AssetIn(key=["list_of_pets"])
})
🎉 1