execute_adhoc_query
Run SQL SELECT queries directly against a data source for results without saving or leaving traces. Destructive SQL is blocked for safe ad-hoc exploration.
Instructions
Execute a SQL query directly against a data source. No query object is created in Redash — leaves no trace. Destructive SQL (INSERT/UPDATE/DELETE/DROP etc.) is blocked. For running queries this is the DEFAULT tool. Use create_query only when user explicitly asks to save a query to Redash web UI.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL query to execute (SELECT only) | |
| format | No | Result format: 'json' returns data in response, 'csv' saves to file and returns file path | json |
| output_path | No | Custom file path for CSV output. If omitted, saves to cwd as adhoc_{timestamp}.csv | |
| data_source_id | No | Data source ID (from list_data_sources). Optional if REDASH_DEFAULT_DATA_SOURCE_ID is set. |