query_dataset
Run MBQL queries on Metabase databases to fetch data, using pagination to exceed the 2000-row hard limit for result sets up to 10,000 rows.
Instructions
Run an MBQL query against a Metabase database. Metabase enforces a hard server-side cap of 2000 rows — use aggregations to work around this. If is_truncated is true and you need more rows, call again with offset: 2000, then 4000, etc. Only do this for small result sets (<10K rows). For larger exports, use export_dataset instead. For time comparisons (WoW, MoM, trends), use a single query with a date breakout instead of multiple queries. MBQL examples: aggregation: [["count"]] or [["sum", ["field", 87, null]]]. filter: ["=", ["field", 10, null], "active"]. breakout: [["field", 42, {"temporal-unit": "month"}]].
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Row limit (max/default 2000 — Metabase hard cap) | |
| filter | No | MBQL filter clause, e.g. ["=", ["field", 135, null], 4] | |
| offset | No | Offset for pagination (use with limit for small result sets <10K rows) | |
| breakout | No | MBQL breakout fields for grouping, e.g. [["field", 91, null]] | |
| table_id | Yes | The table ID (maps to source-table in MBQL) | |
| aggregation | No | MBQL aggregation clauses, e.g. [["count"], ["sum", ["field", 87, null]]] | |
| database_id | Yes | The database ID |