Get data records
get_dataFetch complete raw data records from a specific dataset path. Use filters and field selection to narrow results and avoid refusals on large queries.
Instructions
Fetch raw data records from one dataset path. For totals or averages across groups use get_summary instead — it aggregates server-side.
Results are COMPLETE or refused, never truncated, so counting and averaging over the rows returned is valid. A query matching over 10,000 rows is refused with its true size and how to narrow it. When one is too big, aggregate with get_summary, narrow to a state or district, or hand the user the bulk CSV link from the refusal or the R/Stata snippet from describe_dataset — for whole-country or long multi-year analysis those beat paging through calls.
COST: this hits a live API and a broad query can take 30s+. Filter before fetching rather than issuing many wide calls in parallel.
Args: path: A dataset path from search_datasets with every {placeholder} filled in — "schools/ccd/enrollment/2022/grade-99/race/". One year per call; a leading "/api/v1/" is optional. filters: "fips=11&charter=1". Only fields marked [FILTER] in describe_dataset work; others are rejected here rather than silently returning unfiltered data. Also takes "ordering=" to rank server-side: "ordering=-enrollment" largest first, "ordering=enrollment" smallest. Ranking sorts the whole result before paging, so a ranked query answers where an unranked one is refused as too large. fields: Comma-separated columns — "ncessch,school_name,enrollment". ALWAYS PASS THIS. These tables are 50-96 columns wide; requesting only what you need is typically an 8-17x reduction and is usually the difference between an answer and a refusal. add_labels: Decode coded values to labels (default True). Decoding is per variable, so meanings are FIELD-SPECIFIC — trust the decoded label over any assumption about what a raw code means. preview: Return a small labelled SAMPLE rather than a complete result. The rows are the API's first N by ID, NOT a random sample — never count, rank or average over them.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| fields | No | ||
| filters | No | ||
| preview | No | ||
| add_labels | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |