# willo_execute_sql

> Run one or more SQL statements on the business's backend database — DDL, DML, functions, policies, triggers.

Generated from Willo's code at each release.

Source: https://www.willo.ai/docs/reference/mcp-tools/willo_execute_sql

**Run SQL on the backend.** ALWAYS needs a person's approval: the first call returns `pending_approval` with a dashboard link and a request id; the card shows the statements, a summary computed from them, the objects touched and security findings. After they approve, call again with exactly the same `sql` and it runs — on the draft backend while drafting (Publish replays it live), otherwise on LIVE (the card says so in red). The approved run can take a minute or two when a draft backend must be created first; if it returns status `running`, poll willo_get_approval with the request id for the result — do NOT call again (that asks for a second run). Returns command tags and row counts, never row data (read with willo_db_query). Refused outright, before any card: transaction control (BEGIN/COMMIT), role and login changes, and changes to objects Willo manages on the backend; the refusal names the reason. No undo.

## Access

- **Token**: read + act, and editor access or higher on the business.
- **Approval**: Always. Every call raises a card a person approves on the dashboard.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `sql` | string | yes | One or more statements separated by semicolons, exactly as written. No BEGIN/COMMIT. |
| `reason` | string | no | Optional one sentence for the audit log. The card's summary never comes from this. |

## Related

- [All MCP tools](https://www.willo.ai/docs/reference/mcp-tools)
- [Error codes](https://www.willo.ai/docs/reference/errors)
- [Draft and live](https://www.willo.ai/docs/ai-agents/draft-and-live)
