{
  "id": "python/sqlalchemy-flush-error-null-violation",
  "signature": "sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column \"email\" violates not-null constraint",
  "signature_zh": "列“email”中的空值违反了非空约束",
  "regex": "sqlalchemy\\.exc\\.IntegrityError:\\ \\(psycopg2\\.errors\\.NotNullViolation\\)\\ null\\ value\\ in\\ column\\ \"email\"\\ violates\\ not\\-null\\ constraint",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Attempting to insert or update a row where a NOT NULL column is not provided a value, causing a database integrity error.",
  "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": "Adding default=None to column",
      "why_fails": "",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Calling flush() instead of commit()",
      "why_fails": "",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Provide required values explicitly",
      "success_rate": 0.95,
      "how": "Ensure all NOT NULL columns are assigned values before flush/commit, e.g., user.email = 'user@example.com'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Alter column to allow NULL",
      "success_rate": 0.8,
      "how": "Modify the database schema to allow NULL if appropriate, using ALTER TABLE or migration.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}