# 此会话处于“过期”状态。无法在此事务中发出更多 SQL。

- **ID:** `python/sqlalchemy-exc-invalid-request-session-expired`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

会话因回滚或关闭而过期，尝试对其执行 SQL 会引发此错误。

## 版本兼容性

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

## 解决方案

1. **Close and create new session** (95% 成功率)
   ```
   Close the expired session and create a new one: session.close(); session = Session()
   ```
2. **Start new transaction** (80% 成功率)
   ```
   Use session.begin() to start a new transaction if the session is still in a recoverable state.
   ```

## 无效尝试

- **Using expire_all() to revive session** —  (70% 失败率)
- **Creating new session without closing old** —  (50% 失败率)
