SCHEMA002errorFree tier

pydantic-sqlalchemy-field-mismatch

Pydantic ORM schema references field that doesn't exist in SQLAlchemy model.

Applies to: Project-level

Why this matters

When a Pydantic schema with `from_attributes = True` references a field that doesn't exist in the SQLAlchemy model, you get a runtime AttributeError (usually a 500 error). Pydantic's ORM mode accesses model attributes by name, so field names must match exactly. Either rename the Pydantic field, add an alias, or map manually in the API layer.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, SCHEMA002 includedstablestack explain SCHEMA002

False positive in your codebase? Suppress a single line with # noqa: SCHEMA002