{
  "id": "python/sqlalchemy-unknown-column-type",
  "signature": "sqlalchemy.exc.ArgumentError: Type object 'UUID' is not a valid SQLAlchemy type",
  "signature_zh": "sqlalchemy.exc.ArgumentError: 类型对象 'UUID' 不是有效的 SQLAlchemy 类型",
  "regex": "sqlalchemy\\.exc\\.ArgumentError:\\ Type\\ object\\ 'UUID'\\ is\\ not\\ a\\ valid\\ SQLAlchemy\\ type",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Using a Python type like uuid.UUID directly in a Column definition without a SQLAlchemy type adapter.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Column 定义中直接使用 Python 类型如 uuid.UUID，而没有使用 SQLAlchemy 类型适配器。",
  "versions": [
    {
      "version": "2.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "SQLAlchemy doesn't automatically map Python's uuid.UUID.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "ImportError occurs if not imported properly.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use sqlalchemy.dialects.postgresql.UUID for PostgreSQL: from sqlalchemy.dialects.postgresql import UUID; id = Column(UUID(as_uuid=True), primary_key=True)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use sqlalchemy.types.UUID (available in SQLAlchemy 2.0): from sqlalchemy import UUID; id = Column(UUID(as_uuid=True))",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}