Config Types
Dagster provides a comprehensive configuration system for defining runtime configuration for ops, assets, resources, and other pipeline components. This page documents the core configuration types and utilities.ConfigMapping
Defines a config mapping for a graph or job, allowing you to override configuration for child ops.Constructor
The function that maps the graph config to a config appropriate for child nodes.
The schema of the graph config. Can be a dictionary, a Dagster config type, or None.
If true, config values provided to config_fn will be converted to their Dagster types before being passed in. For example, enum config will be actual enums if true, or strings if false. Defaults to true.
Methods
Validates config against the outer config schema and calls the mapping function against the validated config.Parameters:
config(Any): The unvalidated config to process
DagsterInvalidConfigError if validation failsCalls the mapping function on already-validated config.Parameters:
config(Any): The validated config to process
RunConfig
Container for all configuration that can be passed to a run. Accepts Pythonic definitions for op and asset config and resources.Constructor
Configuration for ops or assets. Keys are op/asset names, values can be Config objects or dictionaries.
Configuration for resources. Keys are resource keys, values can be Config objects or dictionaries.
Configuration for loggers. Keys are logger names, values are configuration dictionaries.
Configuration for the executor. Typically specifies how steps are executed within a run.
Methods
Converts the RunConfig to a dictionary representation compatible with Dagster’s configuration system.Returns:
Dict[str, Any] - The dictionary representation of the RunConfigConfig Schema Types
Dagster supports various configuration schema types for defining structured configuration.Built-in Scalar Types
The following scalar types are available for configuration:Integer configuration type. Validates that the value is an integer.
String configuration type. Validates that the value is a string.
Boolean configuration type. Validates that the value is a boolean.
Float configuration type. Validates that the value is a float or integer.
Structured Config Types
Defines a configuration field with a type, default value, and metadata.Parameters:
config_type: The type of the field (int, str, bool, float, or a ConfigType)default_value: The default value if not providedis_required: Whether the field must be provided (default: True)description: A description of the field
Defines a configuration object with named fields. Used for structured configuration.
Like Shape, but allows additional fields beyond those explicitly defined.
Defines a configuration where exactly one of the provided options must be selected.
Pythonic Config
Dagster provides a Pythonic way to define configuration using theConfig base class:
Features
- Type Safety: Full type checking with mypy/pyright
- Validation: Automatic validation using pydantic
- Defaults: Support for default values
- Nested Config: Compose configuration objects
- Optional Fields: Support for Optional types
Configuration Examples
Op Configuration
Resource Configuration
Job Configuration
Type Aliases
Type alias for config mapping functions:
Callable[[Any], Any]Type alias for values that can be converted to RunConfig:
dict[str, Any] | RunConfigSee Also
- Ops - Learn about op configuration
- Assets - Learn about asset configuration
- Resources - Learn about resource configuration
- Metadata Types - Learn about metadata types
