Can a graph have multiple inputs and if so, how do...
# ask-ai
s
Can a graph have multiple inputs and if so, how do I define that
s
Yes, a graph can have multiple inputs. In Dagster, you define inputs to a graph using the
ins
parameter when decorating a function with
@graph
. The
ins
parameter is a dictionary that maps input names to
GraphIn
instances, which represent the inputs to the graph. Here's an example from the documentation on how to define a graph with multiple inputs:
Copy code
python from dagster import graph, GraphIn  @graph(     ins={"input1": GraphIn(), "input2": GraphIn()}, ) def my_graph(input1, input2):     # Your graph logic here, using input1 and input2     pass
In this example,
my_graph
is a graph with two inputs,
input1
and
input2
. The
GraphIn
instances do not need to be explicitly configured if you are simply passing inputs through; they act as placeholders for the inputs that the graph expects. When you use this graph within a job or another graph, you will need to provide values for these inputs.