Nested types allow embedding complex objects within table rows. Nested types store each field as a separate array column, which can impact query performance for high-throughput paths. Consider Named Tuples for simpler structures stored inline.
Define a separate model and use it as a field type.
class Address(BaseModel): street: str city: str zip: str country: str class User(BaseModel): name: str email: str address: Address # Nested typeNested types can contain other nested types.
class Coordinates(BaseModel): lat: float lng: float class Address(BaseModel): street: str city: str location: Coordinates # Nested within nested class User(BaseModel): name: str address: AddressUse nested types when the structure is known and fixed. Use JSON for dynamic or variable structures.