{
  "id": "python/sqlalchemy-invalid-foreign-key-column-type",
  "signature": "sqlalchemy.exc.ArgumentError: Foreign key 'orders.user_id' column type 'VARCHAR' does not match referenced column 'users.id' type 'INTEGER'",
  "signature_zh": "外键 'orders.user_id' 列类型 'VARCHAR' 与引用列 'users.id' 类型 'INTEGER' 不匹配",
  "regex": "sqlalchemy\\.exc\\.ArgumentError:\\ Foreign\\ key\\ 'orders\\.user_id'\\ column\\ type\\ 'VARCHAR'\\ does\\ not\\ match\\ referenced\\ column\\ 'users\\.id'\\ type\\ 'INTEGER'",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The foreign key column has a different data type than the primary key it references, causing database-level type mismatch.",
  "root_cause_type": "generic",
  "root_cause_zh": "外键列的数据类型与引用的主键类型不同，导致数据库级类型不匹配。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "May break other relationships or data integrity.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Database may reject inserts or cause performance issues.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "class User(Base):\n    id = Column(Integer, primary_key=True)\nclass Order(Base):\n    user_id = Column(Integer, ForeignKey('users.id'))  # not String",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}