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

Varun P

07/17/2023, 6:28 AM
Hey guys Can I set a default value for config schema? Want to do something like this.
Copy code
@op(config_schema={"table_name": str,"insert":True,"alert":True})
I want insert and alert to always be true if I do not pass it as a variable.
dagster bot responded by community 1
🤖 1
j

Johannes Müller

07/17/2023, 11:54 AM
You can check if the value is defined and set the default inside the operation or you can create your own configuration class and add defaults there.
image.png,image.png
z

Zach

07/17/2023, 2:07 PM
If you're using the old-style config schemas you can use the Field class for defining defaults - but I think what Johannes suggested should be preferred at this point;
Copy code
from dagster import Field
@op(config_schema={"insert": Field(default_value=True), "alert": Field(default_value=True)})