Query DataCanvas Table
socrata_dataframe_queryRun SELECT-only SQL against a DataCanvas table populated by socrata_query_dataset. DuckDB infers types from spilled data, so numeric columns that SODA returned as strings become queryable with numeric comparisons (year > 2020, amount < 500). Only works when CANVAS_PROVIDER_TYPE=duckdb is set. Use socrata_dataframe_describe to see registered tables and their schemas.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SELECT-only SQL to run against registered canvas tables. DDL, DML, and file-reading functions are rejected. Use table names from socrata_dataframe_describe. | |
| limit | No | Max rows to return (1–10000). Default 1000. | |
| canvas_id | Yes | Canvas ID returned from socrata_query_dataset or socrata_dataframe_describe. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The row limit that was applied when capped. | |
| sql | No | SQL that was executed. | |
| rows | No | Query result rows. DuckDB may return native JS types (number, boolean, null) for numeric/boolean columns. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Rows returned in this response when capped. | |
| notice | No | Guidance when the SQL returned zero rows. Absent when rows are present. | |
| canvas_id | No | Canvas ID queried. | |
| row_count | No | Number of rows returned. | |
| truncated | No | True when results were capped at the limit — more rows match the query. |