Query staged dataframes with SQL
fdic_dataframe_queryRun one read-only SELECT (DuckDB SQL) across the df_ dataframes that fdic_query_financials and fdic_get_deposits staged or an earlier register_as saved; joins, aggregates, window functions, and CTEs work. Before writing SQL, pass each table name to fdic_dataframe_describe to read its columns. DOUBLE columns come back as JSON numbers and dollar columns are thousands of US dollars; BIGINT results such as COUNT(*) come back as strings, so CAST them to INTEGER or DOUBLE for arithmetic. Writes, DDL, file-reading functions, and system catalogs are rejected. register_as materializes the result as a new dataframe with a fresh TTL.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "fdic_dataframe_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One SELECT against df_<id> tables named in a dataset field or by fdic_dataframe_describe, up to 20,000 characters. | |
| preview | No | Rows to return inline; defaults to the effective row_limit and is clamped to it. Set it low when register_as keeps the full result. | |
| row_limit | No | Requested materialization cap (default 1,000; hard input ceiling 1,000,000), clamped to the execution cap of 10,000. Without register_as, row_count_capped reports more matches; continue with ordered LIMIT/OFFSET pages. register_as keeps the whole result within the staging budget. | |
| register_as | No | Materialize the full result as a new dataframe under this unused name (df_XXXXX_XXXXX: uppercase letters and digits). A name already staged fails as register_as_clash — including on a repeat of a call that already saved it. The live dataframes share a 1,000,000-row budget: the oldest are dropped to make room, and a result over the budget on its own fails as register_as_too_large. Omit to return rows only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The cap that bound: preview when lower, else row_limit. | |
| rows | No | Result rows, bounded by preview and row_limit. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Rows returned inline. | |
| notice | No | Guidance when the query returned no rows or a cap withheld some. | |
| columns | No | Columns in projection order. | |
| row_count | No | Rows the query produced, up to effective_row_limit; with register_as, the exact count of the new dataframe. | |
| truncated | No | True when rows were withheld by preview or row_limit. | |
| expires_at | No | When the register_as dataframe is dropped (ISO 8601). | |
| registered_as | No | Name of the dataframe register_as created. | |
| row_count_capped | No | True when the query matched more rows than effective_row_limit, so row_count is that cap. | |
| effective_preview | No | Inline row cap after clamping preview to the effective row_limit. | |
| requested_preview | No | Explicit preview before clamping; absent when omitted. | |
| effective_row_limit | No | Effective row_limit, at most 10,000. | |
| requested_row_limit | No | Requested row_limit before the execution cap. |