Query Results Grid
query_gridRun read-only SQL and open results in an interactive grid to browse, sort, filter, or export CSV, with editable query re-runs.
Instructions
Run a read-only SQL query and show the results in an interactive grid.
Use this when the user wants to see, browse, sort, filter or export
(CSV) query results, or when a result is too large to read as text. The
user can also edit and re-run the query from the grid. You receive only
a summary with the first 20 rows; the user sees all fetched rows.
Only read-only statements are accepted: SELECT, WITH, SHOW, DESCRIBE,
DESC, EXPLAIN (one statement, no SELECT ... INTO). For writes, DDL or when
you just need a value for your own reasoning, use run_sql instead.
The result includes ``browser_url``, which opens this view full-window in
the user's browser: post it as a clickable link right under the app.
Args:
sql: A single read-only statement.
database: Database to run it against (defaults to the connection's
configured database).
max_rows: Maximum rows to fetch, 1-10000 (default 1000). The result
is flagged as truncated when more rows exist.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| database | No | ||
| max_rows | No |