https://dagster.io/ logo
b

Brad

11/24/2019, 3:15 PM
Are there any other examples using the
Selector
type to limit input values in a config file? I'm trying to configure a solid with multiple parameters, but where one of the parameters is necessarily fixed to be one of a set of possible values
n

nate

11/24/2019, 3:27 PM
hey Bradley! would an enum work for this? looks like we need to document this better, but see this test for an example: https://github.com/dagster-io/dagster/blob/master/python_modules/dagster-graphql/dagster_graphql_tests/graphql/setup.py#L378-L395
b

Brad

11/24/2019, 4:08 PM
Ah interesting. I'll check it out in a bit. Thanks!
e

Eric

11/25/2019, 6:01 PM
I would also be interested in another small example. The documentation mentioned how it would be easy to conceive an example with selectors such as "xlsx, sql, and parquet". Does that mean in the same Selector ?
n

nate

11/26/2019, 10:35 PM
@Eric depends on your use case—`Selector` is useful when you would like to “select” a sub-tree of configuration. for example:
Copy code
config = { 
    'myconfig': Selector({
        'primary': Field(Dict(fields={
             'b': Field(str),
             'c': Field(int),
        }, 
        'secondary': Field(bool),
     }),
}
with this schema,
Copy code
myconfig:
  primary:
     b: "test"
     c: 2
and
Copy code
myconfig:
  secondary: True
are both valid configurations. In contrast,
Enum
is useful when you have a fixed set of scalar configurations to choose from. Hope that helps!
👍 1