# sql-dryrun

Shows how many rows a DELETE/UPDATE/DROP/TRUNCATE will touch before it runs, and sends it to Ulpi's approval prompt when it is too many.

- Type: Plugin
- Version: 0.1.3
- Updated: 22 Nov 2026
- Publisher: Aoyama
- Category: Tools

[Contact us](https://www.ulpi.io/en/support#contact)

## What it does

Shows how many rows a DELETE/UPDATE/DROP/TRUNCATE will touch before it runs, and sends it to Ulpi's approval prompt when it is too many. Built-in approval matches command shape only, so UPDATE with no WHERE, DELETE...

WHERE 1=1, a WHERE that matches every row, and DELETE FROM t; SELECT... WHERE...

all run unprompted; sql-dryrun flags them with the real count ("228,789 of 250,000 rows"). Covers sqlite3, psql and mysql/mariadb (inline -c/-e, heredoc, piped), execute_code, and tools passing SQL in a sql/query/statement argument.

Settings: row_threshold (default 100), mode approve\|block, count timeout. Adds a sql_impact tool for dry-running a statement and a /sql-dryrun command.

Tested on SQLite, Postgres and MariaDB. MIT licensed.

Disclosure — reads the arguments of terminal, execute_code and tools with a sql/query/statement argument. For a destructive statement whose database it can reach, it runs read-only SELECT COUNT(\*) queries: SQLite in-process (mode=ro, trusted_schema=OFF); Postgres/MySQL only via a bare psql/mysql/mariadb resolved with shutil.which and never from inside the working tree, with a minimal env (PATH/HOME/LANG/LC\_\*/TZ plus PG\* except PGOPTIONS, or MYSQL_PWD/HOST/TCP_PORT/UNIX_PORT) and allowlisted connection flags only (options= in a conninfo/URI, any other flag including --defaults-file, or a password prompt skips the count; mysql always runs with --no-defaults).

A statement containing ';' or a backslash is never sent to a database and goes to approval uncounted. Because the WHERE runs before approval, it is only counted when it is a plain predicate (comparisons, AND/OR, IN/EXISTS subqueries, an allowlist of pure built-in functions); any other function call, INTO, FOR UPDATE, '$' or a comment marker skips the count.

Postgres runs BEGIN READ ONLY and verifies SHOW transaction_read_only before counting; MySQL runs inside START TRANSACTION READ ONLY... ROLLBACK; both with a timeout and no password prompt.

Counts only run when terminal.backend i

## Tools it adds

The tools an agent gets once this plugin is installed.

- `sql_impact`

## Review notes

What an owner reads and accepts before the install is approved.

- Ulpi has not reviewed this version: it is listed in the public plugin catalog, and the install still fetches it at its pinned commit, checks its shape and scans it before you approve

## More in Tools

- [ss33 Skill Store](https://www.ulpi.io/en/marketplace/plugins/ss33-skill-store): Find and install agent skills from the ss33 Skill Store without leaving Ulpi.
- [StableLens](https://www.ulpi.io/en/marketplace/plugins/stablelens): Read-only tools for Arc Network, the stablecoin-native L1 where USDC is the gas token: native USDC and Circle token balances.
- [stacktree](https://www.ulpi.io/en/marketplace/plugins/stacktree): Publish what Ulpi builds (reports, dashboards, briefs, proposals) to a private link that opens in any browser with no account for the viewer.

[All listings →](https://www.ulpi.io/en/marketplace) · [Publisher's guide →](https://www.ulpi.io/en/docs) · [Report a problem →](https://www.ulpi.io/en/security#report)
