Datasets & filters
A dataset is data fetched into a keyed store element; bricks bound to that key render it live. Filters let a viewer reshape what they see.
Create a dataset
Add a data brick that writes to a target key:
- ApiData — fetch from an API connection or a public URL.
- SqlData — run a read-only query against a database.
Both support an optional refresh interval for live data.
Bind bricks to it
Set a brick's bindKey to the dataset's key. Charts, StatCards, Tables — even Text and Heading — read their value from that key and re-render when it changes. One dataset can feed many bricks.
Filters that re-query
- Add an Input or Select and give it a bindKey, e.g.
filter.region. - Reference that key in the dataset's params (
{ from: "filter.region" }) and in the query (WHERE region = $1). - When the viewer changes the filter, the dataset re-queries and every bound brick updates.
This is the Superset/Metabase pattern — controls drive the query, the query drives the view.
Collections (repeaters)
To render a list of cards or rows, bind a Repeater to a dataset array; its one child is the per-record template, and child bricks read fields with bindField.
Keep datasets focused: one query per question, each with its own target key (e.g. sales.byRegion,
orders.recent).