Run Query
Run a read-only SQL query on a Draxlr database.
Tool: draxlr_run_query
Runs a read-only SQL query against a database and returns the resulting rows. Only read (SELECT) queries are allowed. The response includes a queryId you can pass to Save Query or Add Query to Dashboard.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
databaseId | string | Yes | The database id (from List Databases) |
sql | string | Yes | The SQL query to run. Must be read-only (SELECT) |
page | integer | No | Page number for pagination (default 1) |
pageSize | integer | No | Rows per page (default 25) |
Example
"Run
SELECT status, COUNT(*) AS orders FROM orders GROUP BY statuson my Sales DB."
Arguments:
{
"databaseId": "665f1c2a9b1e4a0012ab34cd",
"sql": "SELECT status, COUNT(*) AS orders FROM orders GROUP BY status"
}
Response
{
"queryId": "6690aa11bc2e4a0012cd77ee",
"url": "https://app.draxlr.com/explore/665f1c2a9b1e4a0012ab34cd/6690aa11bc2e4a0012cd77ee",
"rowCount": 3,
"columns": ["status", "orders"],
"rows": [
{ "status": "completed", "orders": 812 },
{ "status": "pending", "orders": 143 },
{ "status": "cancelled", "orders": 29 }
]
}
| Field | Description |
|---|---|
queryId | Id of the executed query — use it to save the query or add it to a dashboard |
url | A link to view the query in Draxlr |
rowCount | Number of rows returned on this page |
columns | Column names in the result |
rows | The result rows |
Read-only only:
Non-read statements (INSERT, UPDATE, DELETE, DDL, etc.) are rejected.