# 键错误：'name'

- **ID:** `python/sqlalchemy-exc-statement-error-syntax`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

SQL 语句或 ORM 查询引用了模型或数据库表中不存在的列或属性。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **Add missing column via migration** (95% 成功率)
   ```
   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% 成功率)
   ```
   Correct the query to use existing column names, e.g., user.username instead of user.name.
   ```

## 无效尝试

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