Is there a way to add an arbitrary Pydantic model ...
# ask-community
a
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
d
I'd like to know this as well
a
I have not been able to do so, and I think it is not possible for now. There's an ipen issue related to this : https://github.com/dagster-io/dagster/issues/14564
👍 1