query_sql
Run raw SQL queries against ClickHouse, Postgres, MySQL, or MSSQL through Grafana and retrieve result rows. Use datasource UID from list_datasources to specify the target.
Instructions
Run raw SQL against a SQL-family datasource (ClickHouse, Postgres, MySQL, MSSQL) through Grafana and get rows back. Use list_datasources first to get the uid. Read-only by convention — use a Viewer credential.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Range end, e.g. "now" | now |
| sql | Yes | The SQL to run. Use the database column names, e.g. snake_case, not the app-level ones. | |
| from | No | Range start for $__timeFilter-style macros, e.g. "now-30d" or epoch ms | now-6h |
| datasourceUid | Yes | Datasource uid (or exact name) from list_datasources |