Run Saved Query

Run an existing saved query by its id and get the results.

Tool: draxlr_run_saved_query

Runs an existing saved query by its id and returns the resulting rows — using the query's own definition and saved settings. Works for both query types: raw SQL queries and query-builder queries (see query types below). To run ad-hoc SQL instead, use Run Query. Get a queryId from List Saved Queries or Get Query.

Parameters

ParameterTypeRequiredDescription
queryIdstringYesThe saved query id to run (from List Saved Queries or Get Query)
databaseIdstringNoThe database the query belongs to. Resolved from the query automatically if omitted
pageintegerNoPage number for pagination (default 1)
pageSizeintegerNoRows per page (default 25)

Query types

Draxlr saved queries come in two forms, and this tool handles both automatically:

  • Raw — written as SQL (has a rawQuery). These are what an assistant generates.
  • Builder — built visually in the Draxlr UI (no SQL; based on a table). These are identified by a tableId and run against a different endpoint under the hood.

The tool inspects the saved query and routes to the correct engine for you, so you only need the queryId.

Example

"Run my saved 'Orders by status' query."

Arguments:

{
  "queryId": "6690aa11bc2e4a0012cd77ee"
}

Response

{
  "queryId": "6690aa11bc2e4a0012cd77ee",
  "type": "raw",
  "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 }
  ]
}
FieldDescription
queryIdId of the saved query that was run
typeraw (SQL) or builder (built in the Draxlr UI)
urlA link to view the query in Draxlr
rowCountNumber of rows returned on this page
columnsColumn names in the result
rowsThe result rows

Read-only only:

Only read (SELECT) queries can be run. Non-read statements are rejected.