Skip to content

statement

Databricks Statement Execution helpers for the Mastra plugin.

Wraps client.statementExecution.getStatement with the shape and size handling the plugin’s tools and the /embed/data/:id route both need: a low-level fetch that returns a raw {columns, rows, rowCount} shape and coerces numeric strings to numbers so downstream charts and aggregations don’t have to, plus a hard row cap callers clamp limit to so a runaway result set can’t hose a response. Upstream 404s are detected via error.errorContext(err).notFound at the call sites.

Not Genie-specific: a Databricks statement_id is workspace scoped and lives in the Statement Execution API regardless of which producer (Genie, a tool, a notebook, etc.) submitted the query. Co-located here so consumers can fetch / cap / handle 404s without reaching into the Genie tool module.