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

Charlie Bini

04/20/2022, 8:06 PM
is there something like
Permissive
that I can use in a
config_schema
except the only allowable keys are defined but not mandatory?
1
for example, I have this:
Copy code
config_schema={
        "tables": Field(
            Array(
                Permissive(
                    {
                        "name": String,
                        "queries": Array(),
                    }
                )
            )
        ),
    },
name
should be required but
queries
is optional. However, those are the ONLY acceptable values of the dict
j

johann

04/20/2022, 8:10 PM
You can use
Field(is_required=False, default_value=...)
c

Charlie Bini

04/20/2022, 8:11 PM
so
queries
can be
Field(...)
even though it's nested inside another field?
j

johann

04/20/2022, 8:12 PM
Yep, and you’d remove Permissive
c

Charlie Bini

04/20/2022, 8:12 PM
thanks I'll try that and report back
d

dwall

04/20/2022, 8:12 PM
oh wow TIL
j

johann

04/20/2022, 8:15 PM
Oh sorry- you’ll want to replace
Permissive
with
Shape
, the equivalent object for when you want a strict schema. Here’s an example of nested Fields https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster/core/run_coordinator/queued_run_coordinator.py#L81-L98
c

Charlie Bini

04/20/2022, 8:23 PM
wowza
yup that did it
FYI my example above becomes:
Copy code
config_schema={
        "tables": Field(
            Array(
                Shape(
                    {
                        "name": String,
                        "queries": Field(Array(...), is_required=False),
                    }
                )
            )
        ),
    },
for anyone finding this
2 Views