> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ModelSchema

> Defines the complete schema structure for a model's input data.

Defines the complete schema structure for a model's input data.

ModelSchema contains the specification of all columns that a model expects
to receive, including their data types, constraints, and metadata. This schema
is used by Fiddler for data validation, monitoring, and analysis purposes.

The schema acts as a contract between your model and Fiddler, ensuring that
incoming data conforms to expected formats and enabling proper drift detection,
data quality monitoring, and other features.

## Examples

Creating a model schema:

```python theme={null}
schema = ModelSchema(
    columns=[
        Column(name="age", data_type=DataType.INTEGER, min=0, max=120),
        Column(name="income", data_type=DataType.FLOAT, min=0),
        Column(name="category", data_type=DataType.CATEGORY,

        categories=["A", "B", "C"])
    ]
)
```

Accessing columns by name:

```python theme={null}
age_column = schema["age"]
print(age_column.data_type)
```

Adding a new column:

```python theme={null}
new_column = Column(name="score", data_type=DataType.FLOAT)
schema["score"] = new_column
```

Removing a column:

```python theme={null}
del schema["age"]
```

## model\_config

Configuration for the model, should be a dictionary conforming to \[ConfigDict]\[pydantic.config.ConfigDict].

## schema\_version

Schema version

## columns

List of columns

## **getitem**()

Get column by name

### Returns

[`Column`](/sdk-api/python-client/column)

## **setitem**()

Set column by name

## **delitem**()

Delete column by name
