Skip to content

Function: fetchStatementData()

fetchStatementData(client, statementId, options?): Promise<{ columns: string[]; rowCount: number; rows: Record<string, unknown>[]; }>

Fetch a single statement’s rows via the Statement Execution API and reshape into the shared GenieDatasetData shape (column array + row records).

Optional limit slices the returned rows client-side so the agent can scan a small sample without paging the full result set into context. rowCount always reflects the upstream total so callers know when the slice truncated.

Exported because every consumer in the plugin (the get_statement tool, the prepare_chart dataset resolver, and the /embed/data/:id route) needs the exact same fetch + coercion pipeline so LLM-side get_statement output and UI-side [data:<id>] rendering stay shape-identical for the same statement_id.

WorkspaceClient$1

string

number

AbortSignal

Promise<{ columns: string[]; rowCount: number; rows: Record<string, unknown>[]; }>