{
  "slug": "wrangler-json-supports-native-analytics-sql-bindings-in-local-development-2f829d47c083",
  "title": "wrangler.json supports native Analytics SQL bindings in local development",
  "tools": [
    "wrangler"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-09-30T14:36:05.000Z",
  "announced_at": "2026-09-30T14:36:05.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a Worker uses Analytics SQL during local development, declare `analytics.binding` in `wrangler.json` and run `wrangler dev`; call it through `env.<BINDING>.query()` without `unsafe.bindings`.",
    "examples": [
      "{\n  \"analytics\": {\n    \"binding\": \"ANALYTICS\"\n  }\n}",
      "export default {\n  async fetch(_request, env) {\n    const result = await env.ANALYTICS.query({\n      query: \"SELECT COUNT(*) AS requests FROM events.httpRequests\",\n    });\n    return Response.json(result);\n  },\n};",
      "wrangler dev"
    ],
    "gotchas": [
      "Version: 4.145.0",
      "analytics.binding (required): Name used to access the Analytics SQL binding on the Worker `env` object.",
      "query (required): One SQL `SELECT` statement; use `$1` or `$name` for parameter placeholders.",
      "Prerequisite: Wrangler 4.145.0 or later.",
      "Prerequisite: Analytics SQL has no local implementation; the binding always connects to the remote service during local development."
    ]
  },
  "why_it_matters": "During local development of a Worker that uses an Analytics SQL binding, configure the binding and call it with `wrangler dev`.",
  "sources": [
    "https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.145.0",
    "https://developers.cloudflare.com/workers/runtime-apis/bindings/analytics-sql/",
    "https://developers.cloudflare.com/workers/wrangler/commands/workers/",
    "https://developers.cloudflare.com/workers/wrangler/configuration/"
  ],
  "rank": 0.92021,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "gap-20261007",
    "verdict_id": "gap-20261007:gap-20261007-d1d092289be53894-0:gate",
    "evidence_hash": "c35c2be49303b49b11772089482a3e67943136eb8187ee21fd9ed85016fcd6ac"
  },
  "review": {
    "draft_hash": "2ce5c789d2081bafe0584e119c16ab7b3143211f5d7db0b6ce318c04f62ec746",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "gap-20261007:gate",
    "reason": "2 of 3 judge runs approved with p_yes >= 0.9 (mean 0.92 >= 0.9; 2 needed) and Jev gave 0.75 (>= 0.6 needed)."
  }
}
