Hey guys Can I set a default value for config sche...
# ask-community
v
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
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
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)})