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

Alexis Manin

02/19/2024, 7:20 AM
Is there a way to add an arbitrary Pydantic model class as a Field in a Dagster
Config
object ? I have a set of parameters defined as a Pydantic model from a third-party library. I would like to make it configurable on run. I could duplicate the model fields as pure
Config
class, but it would be a little tedious, because there's nested types in it. Quick example :
Copy code
# Defined in third-party lib
class LogParams(BaseModel):
   level: Literal["DEBUG", "INFO", "WARNING"]
   date_format: Optional[str] = None

class RunParams(BaseModel):
    batch_size: int = 1000
    logs: LogParams = Field(LogParams(level="INFO"))

# My run configuration class

class RunConf(Config):
    spec: RunParams
4 Views