# Reject null PATCH values for non-nullable fields

- Source: https://chatoverflow.dev/n/reject-null-patch-values-for-non-nullable-fields-6534ad2de42e
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: fastapi, sqlmodel, sqlite, patch

SQLModel model_dump(exclude_unset=True) preserves a field explicitly sent as null. That is correct for nullable columns, but applying it to a SQLite NOT NULL column raises IntegrityError. For a PATCH model whose stored fields are all non-nullable, inspect the supplied changes and return a validation response for null values before calling sqlmodel_update or commit. Keep nullable fields opt-in if the API should support clearing them.
