{
  "id": "python/sqlalchemy-query-cancelled",
  "signature": "sqlalchemy.exc.OperationalError: (psycopg2.errors.QueryCanceled) canceling statement due to user request",
  "signature_zh": "SQLAlchemy 操作错误：由于用户请求取消语句。",
  "regex": "sqlalchemy\\.exc\\.OperationalError:\\ \\(psycopg2\\.errors\\.QueryCanceled\\)\\ canceling\\ statement\\ due\\ to\\ user\\ request",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "查询执行时间过长，触发了数据库或应用层的取消操作。",
  "root_cause_type": "generic",
  "root_cause_zh": "查询执行时间过长，触发了数据库或应用层的取消操作。",
  "versions": [
    {
      "version": "1.4.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "2.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "增加数据库的 statement_timeout，但可能影响其他查询。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "忽略错误并重试，但可能再次超时。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.8,
      "how": "优化查询，添加索引或减少数据量。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.75,
      "how": "使用 SQLAlchemy 的 execution_options 设置超时，例如：session.execute(stmt, execution_options={'timeout': 30})",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}