query
Run one read-only SELECT or WITH statement against a saved SQL Server or PostgreSQL profile to return columns and rows, using SQL aggregation to stay within per-profile row and cell limits.
Instructions
Run one read-only SELECT (or WITH ... SELECT) on a profile and get columns and rows. Aggregate in SQL (GROUP BY, TOP/LIMIT) instead of fetching raw rows: results stop at the profile's row limit (500 unless the user changed it), cells at 2 KB, and truncated: true means the answer is partial. Writes, EXEC, multiple statements and functions with side effects are refused; quote a column named like an SQL keyword. SQL Server reads uncommitted data, like the health check.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | one SELECT or WITH ... SELECT statement | |
| profile | Yes | profile name from list_profiles | |
| database | No | database name from list_databases; default: the profile's | |
| max_rows | No | row limit; default and ceiling: the profile's | |
| timeout_s | No | seconds; default and ceiling: the profile's |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| rows | Yes | ||
| columns | Yes | ||
| warning | No | ||
| truncated | Yes | ||
| elapsed_ms | Yes |