Query FEMA DataCanvas Table
fema_dataframe_queryRun a read-only SQL SELECT against a DataCanvas table staged by fema_search_nfip. Enables aggregation, GROUP BY, SUM/COUNT, time-series, and filtered analysis over the full NFIP claims result without re-fetching from the API. Call fema_dataframe_describe first to get the exact table name and column names needed for valid SQL. Only SELECT statements are allowed — DDL, DML, COPY, and file-reading functions are blocked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL SELECT statement to run against the staged table. Use the table name from fema_dataframe_describe. Results are capped at the canvas row limit; append LIMIT/OFFSET to page through additional rows, or aggregate (GROUP BY, COUNT, SUM) to summarize the full set in one query. Example: "SELECT year_of_loss, COUNT(*) AS claims, SUM(amount_paid_building) AS total_building_paid FROM df_nfip_abc123 GROUP BY year_of_loss ORDER BY year_of_loss" | |
| canvas_id | Yes | Canvas ID from the fema_search_nfip response (the canvas_id field). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The canvas row limit that was applied when the result was capped. | |
| rows | No | Result rows from the query. May be capped at the canvas row limit — when the truncated enrichment field is set, page the remainder with LIMIT/OFFSET (see the notice guidance). | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of rows returned in this (capped) response. | |
| notice | No | Continuation guidance when capped — how to page the remainder with LIMIT/OFFSET. | |
| canvas_id | No | Canvas ID that was queried — reuse for follow-up queries. | |
| row_count | No | Number of rows in this response (may be capped at the canvas row limit). | |
| truncated | No | True when the result was capped at the canvas row limit — more rows match than were returned. |