types
Module for handling type conversion.
make_nullable_array(schema)
make_nullable_field(schema)
make_nullable_struct(schema)
make_spark_schema_nullable(schema)
Make a spark type nullable.
Source code in spark_instructor/utils/types.py
pydantic_to_typeddict(pydantic_model, return_type, all_required=False)
Convert a pydantic model to a typed dict.
Source code in spark_instructor/utils/types.py
typeddict_to_pydantic(typeddict_class)
Convert a TypedDict to a Pydantic model using TypeAdapter and core_schema.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
typeddict_class |
Type[Any]
|
The TypedDict class to convert. |
required |
Returns:
Type | Description |
---|---|
Type[BaseModel]
|
Type[BaseModel]: A Pydantic model class equivalent to the input TypedDict. |