Water Dataframe Query
water_dataframe_queryRun a read-only SQL SELECT against water data tables staged on a DataCanvas by water_get_series or water_find_sites. Workflow: run water_get_series or water_find_sites (get canvas_id + table_name) → water_dataframe_describe (confirm the table and its columns) → water_dataframe_query (SQL analysis), then optionally water_dataframe_drop (when this server enables it) to remove a table you are done with. Only SELECT statements are permitted. Returns at most 5,000 rows, or this server instance's canvas row limit when that is lower; a query matching more is capped and the response sets truncated=true, with row_count equal to the cap applied — scope with WHERE/LIMIT, and use SELECT COUNT(*) or water_dataframe_describe to learn the true match count. Requires DataCanvas to be enabled on this server instance. Returns an error if DataCanvas is not available.
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": {
"canvas_id": "<canvas_id>",
"sql": "<sql>"
},
"name": "water_dataframe_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Read-only SELECT statement. Reference the table by the table_name from water_get_series or water_find_sites; columns vary by source table, so run water_dataframe_describe first for the exact schema. Example on an instantaneous series table: SELECT time_utc, value FROM water_series_01646500_00060_iv_20261101_20261108 ORDER BY time_utc DESC LIMIT 10. Write a window relative to now as WHERE CAST(time_utc AS TIMESTAMPTZ) > now() - INTERVAL 6 HOUR. | |
| canvas_id | Yes | Canvas ID returned by water_get_series or water_find_sites. Identifies the canvas holding the data. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | Result rows returned, at most 5,000 rows, or this server instance's canvas row limit when that is lower. Column names match the SELECT clause. | |
| error | No | Present when the call failed. Absent on success. | |
| row_count | No | Number of rows returned in the rows array (at most 5,000 rows, or this server instance's canvas row limit when that is lower), not the total matched by the query. When truncated is true the cap was reached, so row_count equals the cap applied and undercounts the true total. To get the true match count run SELECT COUNT(*) with the same filter, or call water_dataframe_describe for the full row count of the staged table; page large results with LIMIT/OFFSET. | |
| truncated | No | True when the query matched more rows than the cap (5,000 rows, or this server instance's canvas row limit when that is lower) and the result was capped — rows and row_count then cover only the first row_count matches, and the rest are not in this response. False means rows and row_count are the complete result for this query. When true, narrow the query with WHERE, page with LIMIT/OFFSET, or run SELECT COUNT(*) with the same filter for the true total. |