Query a connected table
query_tableA bounded, structured query over one table's current version. NO SQL: send columns, filters, order_by, aggregates, group_by and limit as JSON. Example: {"table_id": "0f2f...", "columns": ["observed_at", "air_temp_f"], "filters": [{"column": "air_temp_f", "operator": "gte", "value": 80}], "order_by": [{"column": "observed_at", "direction": "desc"}], "limit": 50}. Ceilings: 64 columns, 8 filters, 2 sort keys, 4 aggregates, 4 group keys, 10000 rows a page (25 when limit is omitted), 8 MiB of JSON. Every page answers with next_cursor; send it back as cursor (same columns, filters and order_by) for the next page until it is null, and you have read the whole table on one immutable version. Operators, all ANDed: eq, neq, in (an array of at most 20 values), gt, gte, lt, lte, is_null and is_not_null (no value), between (exactly two non-null bounds, inclusive at both ends), and contains, starts_with and ends_with (one non-empty string, case-sensitive, text columns only). Dates and timestamps compare as ISO strings, so a month is one between or a gte plus an lt. GROUPED AGGREGATES: send group_by beside aggregates for one row per distinct combination, keyed by the group column names and the aggregate aliases. Example: {"table_id": "0f2f...", "columns": ["station"], "group_by": ["station"], "aggregates": [{"function": "avg", "column": "air_temp_f", "as": "avg_temp"}], "order_by": [{"column": "avg_temp", "direction": "desc"}], "limit": 10}. An aggregate answers under its as, or under {function}{column or "all"}{position} without one. group_by needs at least one aggregate, no two result columns may share a name and names are compared without case (group_by ["city"] refuses an alias of "CITY", and two aggregates cannot share one alias), and order_by may only name a group column or an alias. limit counts GROUPS, execution.truncated means the limit was reached so there may be more groups, and a grouped answer has no next page: next_cursor is null and offset and cursor stay refused beside aggregates. Without group_by an aggregate query returns one row for the whole table and cannot be ordered. TEXT SEARCH: when get_table_schema returns capabilities.search, add search: {"text": "...", "columns": its keyword_columns (or some of them), "spec_digest": its spec_digest} for the existing all-terms search and its unchanged response. For words, prefixes, typos and meaning on public tables, explicitly add search.engine: "resident" and search.settled: true. Public ready packages return rows, applied plan, planner origin/reason, package generation/digest, timings and next_cursor without a total. Send later pages with search.plan and search.cursor; explicit search.plan is validated by the service and invalid_plan diagnostics pass through. Request lazy count separately with search.plan and search.count (matching_rows or relevance_window). Preparing/unavailable first pages answer by the existing scan with a path note; an unavailable continuation returns restart_required (restart_from: 1). Scan fallbacks do not apply the resident plan; count covers lexical matching rows. Private and link-shared tables retain scan search and explain unsupported resident members in the note. For scan answers, execution.search_mode says how it ran and execution.search_scope what the count covers. A refusal saying search is unavailable means the table's version changed: call get_table_schema again. Requires an mr_use_ workspace key (Authorization: Bearer) or an OAuth connection. The first query over a dataset connects it to the workspace; connect_dataset makes that explicit but is not required. Resident answers return row_id and fields, the applied plan, planner, package and timings; cite the package generation/digest. Scan answers return rows plus table.version_id and table.content_digest; cite those. For the whole table in one request, download the Parquet instead. Reads past the free sample (the first 500 rows of a table in stored order) count against the workspace's shared free monthly allowance of 100,000 rows and 1,000 queries (the workspace of the key or grant in use) unless it is subscribed. A download counts the rows it contains, plus one query per table. At the limit the tool answers usage_limit_exceeded with the reset time and an upgrade URL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| cursor | No | ||
| offset | No | ||
| search | No | ||
| columns | Yes | ||
| filters | No | ||
| group_by | No | ||
| order_by | No | ||
| table_id | Yes | ||
| aggregates | No |