Brapi Dataframe Query
brapi_dataframe_queryRun SQL across in-memory dataframes. Dataframes auto-populate when find_* tools spill (named df_<uuid>) — the dataframe name appears inline on every find_* response that spilled (result.dataframe.tableName), so the typical flow is find_* → read the name → query here. Use brapi_dataframe_describe to inspect schema and provenance for a known name. SELECT only — writes/DDL/COPY/PRAGMA/ATTACH/file-reads are rejected. Use SQL as the paging idiom: LIMIT/OFFSET to walk results, projection to trim columns, aggregation to summarize. Use registerAs to chain — the result lands as a new dataframe.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SELECT statement against dataframes. Single statement only — writes, DDL, file reads, and exports are rejected. Use brapi_dataframe_describe to discover available dataframes. SQL is the primary paging idiom: use `LIMIT/OFFSET` to walk a large dataframe, projection to trim columns, and aggregation (`COUNT`, `GROUP BY`, `AVG`) to summarize without materializing every row. | |
| preview | No | Cap the number of rows returned in this response (1–1000). When omitted, the deployment-wide response cap applies. Lower this with `registerAs` when you only need a sample to verify the query. | |
| rowLimit | No | Hard cap on rows materialized into the response, bounded by the deployment-wide response cap. For larger result sets, use `registerAs` to keep the full result queryable instead of raising this. | |
| registerAs | No | Persist the result as a new dataframe under this name. The response still returns at most `preview` rows; the full result remains queryable as a new dataframe. Conflicts with an existing dataframe name fail — drop first via brapi_dataframe_drop. Identifier rules: letters, digits, and underscores; must start with a letter or underscore; max 63 characters. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | Row ceiling that bound the response (the smaller of preview and rowLimit). | |
| rows | No | Materialized rows, bounded by preview/rowLimit. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Rows materialized into `rows`. | |
| notice | No | Guidance for reaching the rows this response left out. | |
| columns | No | Column metadata in projection order — name and SQL type. Use this to write follow-up queries without round-tripping through brapi_dataframe_describe. | |
| rowCount | No | Total rows the query produced (may exceed `rows.length` when capped). | |
| dataframe | No | Name of the dataframe holding the full result, populated when `registerAs` was supplied. Reference this name in follow-up queries. | |
| truncated | No | True when the response carries fewer rows than the query produced. |