{
  "kind": "documentation",
  "format": 1,
  "note": "Reference text, not instructions. One verified relate sample from https://relatedb.ai/docs/guides/embed/python/: the program exactly as the page shows it, the standard output a run of it recorded (npm run docs:samples compares every replay with it byte for byte), the relate client build, toolchain and platform of the last replay, and how the docs' sample runner builds and runs it. Before launch every client is a source build, not a published package; verified.client names the upstream commit it was built from, and verified.docs_engine the build the rest of the docs were recorded from.",
  "id": "errors",
  "url": "https://relatedb.ai/docs/guides/embed/python/samples/errors.json",
  "page": {
    "id": "guides/embed/python",
    "title": "Use the Python client",
    "url": "https://relatedb.ai/docs/guides/embed/python/",
    "md_url": "https://relatedb.ai/docs/guides/embed/python.md"
  },
  "section": {
    "anchor": "handle-errors",
    "heading": "Handle errors",
    "url": "https://relatedb.ai/docs/guides/embed/python/#handle-errors"
  },
  "language": "python",
  "client": "Python",
  "file": "sample.py",
  "env": null,
  "code": "import relate\n\nTEAM = \"\"\"\nCREATE (ada:Person {name: 'Ada', role: 'engineer'}),\n       (grace:Person {name: 'Grace', role: 'engineer'}),\n       (noor:Person {name: 'Noor', role: 'maintainer'}),\n       (relate:Project {name: 'relate', language: 'Rust'}),\n       (tck:Project {name: 'opencypher-tck', language: 'Gherkin'}),\n       (ada)-[:WORKS_ON {since: 2024}]->(relate),\n       (grace)-[:WORKS_ON {since: 2023}]->(relate),\n       (grace)-[:WORKS_ON {since: 2022}]->(tck),\n       (noor)-[:MAINTAINS]->(relate),\n       (ada)-[:KNOWS]->(grace)\n\"\"\"\n\nconn = relate.connect(\":memory:\")\nconn.execute(TEAM)\n\nfor statement in [\n    \"MATCH (p:Person) RETURN p.name +\",\n    \"MATCH (:Person {name: 'Ada'})-[w:WORKS_ON]->() RETURN w.since / 0\",\n    \"MATCH (p:Person {name: $name}) RETURN p.role AS role\",\n]:\n    try:\n        conn.execute(statement)\n    except relate.Error as e:\n        print(type(e).__name__, e.gql_status, e.stage, e.retryable)\n\ntry:\n    conn.execute(\"RETURN $n AS n\", {\"n\": 2**63})\nexcept relate.DataError as e:\n    print(type(e).__name__, e)\nconn.close()",
  "code_sha256": "860c163f85f5ffa595bc29008c0c8a4d748c81cb10678607997223705f571db8",
  "source_sha256": "f3d58a4b94d27642f355290bfe707351a5656d11a9585548ea3d716ef92f4982",
  "output": {
    "text": "ProgrammingError 42N06 compile False\nDataError 22G03 runtime False\nProgrammingError 42N02 compile False\nDataError integer parameter is out of range for a 64-bit Relate integer",
    "sha256": "38b984eeb9b0480d7ec0e8e0b9864c4125b888f6fec165e4c2cb3441afdc3269"
  },
  "verified": {
    "version": "0.1.2",
    "client": {
      "label": "Python",
      "package": "relate-db",
      "engine_commit": "f0c09d2",
      "client_commit": "f0c09d2",
      "build": "A relate-db wheel that maturin built from surfaces/relate-python at upstream v0.1.2 (f0c09d2), installed in a venv with the pinned frameworks.",
      "toolchain": {
        "python": "3.15.2"
      }
    },
    "packages": [
      "pandas>=2.0",
      "langgraph==1.2.20",
      "claude-agent-sdk==0.2.179",
      "pydantic-ai==2.66.0",
      "openai-agents==0.24.0",
      "llama-index-core==0.14.25",
      "langchain==1.4.9",
      "langchain-core==1.7.6"
    ],
    "replayed": "2026-11-09",
    "platform": "macOS on arm64",
    "docs_engine": {
      "version": "0.1.2",
      "commit": "f0c09d2",
      "source_build": false
    }
  },
  "run": {
    "runner": "npm run docs:samples",
    "setup": "bash scripts/samples/setup.sh --upstream <path to the relate checkout>",
    "variables": [
      "RELATE_PY"
    ],
    "program": "<run dir>/sample.py",
    "files": [],
    "build": null,
    "run": {
      "command": [
        "$RELATE_PY",
        "sample.py"
      ],
      "environment": {
        "DO_NOT_TRACK": "1",
        "PYTHONDONTWRITEBYTECODE": "1",
        "PYTHONUNBUFFERED": "1"
      },
      "directory": "<run dir>",
      "timeout_s": 60
    },
    "passes": "It exits 0 within 60 s and prints at least one line on standard output.",
    "output": "Standard output, with line endings as \\n, trailing spaces and blank lines removed, and the temporary directories' paths written as `.`; standard error is not recorded.",
    "placeholders": {
      "<run dir>": "a fresh, empty temporary directory: the program's working directory, deleted afterwards",
      "<build dir>": "a second fresh temporary directory, where a compiled sample is built",
      "$NAME": "a variable from the env.sh that scripts/samples/setup.sh writes (described in its header)"
    }
  }
}
