# sqlalchemy.exc.StatementError: (builtins.KeyError) 'name'

- **ID:** `python/sqlalchemy-exc-statement-error-syntax`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A SQL statement or ORM query references a column or attribute that does not exist in the model or database table.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **Add missing column via migration** (95% success)
   ```
   Check the model definition and database schema to ensure the column exists, then add it via migration if missing.
   ```
2. **Use correct column name** (90% success)
   ```
   Correct the query to use existing column names, e.g., user.username instead of user.name.
   ```

## Dead Ends

- **Adding column to model only** —  (60% fail)
- **Switching to raw SQL** —  (50% fail)
