Data models & relationships
A data model sits between a data source and your dashboards: a curated set of tables, joined by relationships, enriched with calculated fields and measures. Dashboards built on the same model share its joins and definitions, so numbers stay consistent across your team.
Create a model
Section titled “Create a model”From Data Models, choose New Model: give it a name, pick the data source it’s built on (a model is always bound to one source), and optionally a description. The list shows each model’s table/field counts, version badge, and Certified/Draft status.
Import tables
Section titled “Import tables”In the model editor, Import Tables opens the source’s schema: pick a schema, check the tables you want (each shows an approximate row count), and import. If the source hasn’t been profiled yet you’ll be prompted to run schema discovery first.
After importing, DataSquares queues AI relationship suggestions — likely joins detected from names and data, which you review before they count.
Define relationships
Section titled “Define relationships”The editor is a visual canvas: tables are nodes, relationships are edges. Drag from one column (or table) to another to open Define relationship, where you pick:
- the join columns on each side,
- cardinality — one-to-one, one-to-many, or many-to-many,
- join type — inner, left, right, or full.
Edges are labeled with both, and AI-suggested relationships render as dashed green edges until you confirm them. Click an edge to change its type or delete it (deleting warns you: charts that combine those tables stop joining).
Inspect the data
Section titled “Inspect the data”Double-click any table node (or use View data) to browse its actual rows — with a row limit, search, per-column filters (contains, equals, greater/less than, empty/set), and sortable columns. Handy for sanity-checking a join key before you commit to it.
Keep the schema fresh
Section titled “Keep the schema fresh”Sync Schema re-reads table structures from the source and reports what changed — new fields added, vanished fields hidden, tables that no longer exist. Run it after upstream schema changes rather than re-importing.
Hierarchies
Section titled “Hierarchies”Add Hierarchy defines an ordered drill path — e.g. Region → City → Store — on one table. Charts built on the model use hierarchies for drill-down.
Row-level security
Section titled “Row-level security”Under Security, add RLS policies: a per-table filter expression (like
region = 'US') applied to users matching a role. RLS is structural — it
applies beneath every chart, measure, export, and share built on the model,
and SquareX measures can never remove it.
Publish & versions
Section titled “Publish & versions”Publish snapshots the model as a version (and sets the Published badge); Version History shows the current and prior versions with their publish timestamps. Work in draft, publish when dashboards should pick up the changes.
Related
Section titled “Related”- Calculated fields — row-level expressions on model tables.
- SquareX measures — model-level, filter-aware calculations.
- Data quality — tests and monitoring on top of your models.