Secedgar Dataframe Query
secedgar_dataframe_queryRun a single-statement SELECT against the canvas dataframes registered by secedgar_fetch_frames, secedgar_search_filings, and secedgar_get_financials. Read-only: writes, DDL, DROP, COPY, PRAGMA, ATTACH, and external-file table functions are rejected. System catalogs (information_schema, pg_catalog, sqlite_master, duckdb_*) are denied — list dataframes via secedgar_dataframe_describe. Optional register_as chains the result as a new dataframe with a fresh TTL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Single-statement SELECT against df_<id> tables on the shared canvas. Standard DuckDB SQL — joins, aggregates, window functions, CTEs all supported. Reference dataframes by the names returned in fetch/search responses or listed by secedgar_dataframe_describe. BIGINT columns (e.g., XBRL `value`, COUNT/SUM results) serialize as JSON strings to preserve precision past 2^53 — CAST(col AS DOUBLE) in projections for inline arithmetic. | |
| preview | No | Rows to include in the immediate response. Defaults to the row limit. Set lower (e.g., 50) when chaining via register_as and only a sample is needed inline. | |
| row_limit | No | Hard cap on rows materialized in the response. Default 1000, max 10000. The full result lives on-canvas under register_as when provided — do not raise this to keep large results. | |
| register_as | No | When set, persist the result as a new dataframe under this name (must match df_XXXXX_XXXXX shape, or pass a fresh df_<id> generated by the agent). Fresh TTL window — not inherited from the parents in the SELECT. Use to chain analyses without re-running the source SQL. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The row cap that actually bound — `preview` when it is lower than `row_limit`, otherwise `row_limit`. | |
| rows | No | Materialized rows, bounded by `preview` / `row_limit`. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of rows returned inline. | |
| notice | No | Guidance when the query returned no rows, or when the row cap withheld some. | |
| columns | No | Column names in projection order. | |
| row_count | No | Total rows the query produced (may exceed `rows.length` when capped). | |
| truncated | No | True when the result set held more rows than the row cap allowed through. | |
| expires_at | No | ISO 8601 expiry timestamp for the newly registered dataframe, when applicable. | |
| registered_as | No | Set when `register_as` was supplied and the new dataframe was materialized. |