Hey :wave: I’m looking for the most dagster-y way ...
# ask-community
c
Hey 👋 I’m looking for the most dagster-y way to have an op that takes either a config or an input. I’m writing a reusable
create_database_schema()
op that I would like to either accept a
name
config or input from another upstream op. I can make them both optional and raise an error if both are
None
, but curious if there’s a better construct in the Dagster framework for something like this?
m
Hi Charles! As you can imagine we have gone back and forth on this quite a bit. What API would feel most intuitive here?
c
Hey Max! Good question — I get why inputs and config were created as 2 different concepts, but for this particular scenario, it feels like having a single construct for inputs (that can be configured) would help. I don’t know that it’s the best generalized solution though 🤔 For instance, I would like to define this op as:
Copy code
@op()
def create_database_schema(context, name: str):
  context.database.create_schema(name)
And then be able to use it either as:
Copy code
@job
def my_job():
  schema = create_database_schema() # this is defined in the config
  ... = another_op(schema)
Or as:
Copy code
@job
def my_job():
  get_list_of_schema().map(lambda schema: create_database_schema(schema))
m
ah great -- all inputs can be configured
c
Ahh I see! Oops, I didn’t know this was possible — thanks! 🙏
👍 1