- ds
- Operations
- Schema
Schema
Tables, columns, types and keys.
| Column | Type | Keys | Description |
|---|---|---|---|
| order_id | STRING | PK | ord_ prefixed, from checkout-api. |
| customer_id | STRING | FK customers.id | |
| order_date | DATE | Partition | Day the order was placed, IST. |
| merchant_id | STRING | ClusterFK merchants.id | |
| amount_minor | INT64 | In paise. Divide by 100 for rupees. | |
| currency | STRING | ISO 4217. | |
| customer_email | STRING | PII | Masked outside the finance role. |
| items | ARRAY<STRUCT> | One entry per line item. | |
| sku | STRING | ||
| qty | INT64 | ||
| unit_minor | INT64 | ||
| settled_at | TIMESTAMP | Null until the payment provider settles. | |
| _loaded_at | TIMESTAMP | Set by the loader. Use for incremental models. |
13 columnsOwner: data-platformUpdated by dbt · fct_orders.sql
Show code
<div class="schema">
<header class="schema-head">
<span class="label">Table</span>
<b><span>analytics.</span>fct_orders</b>
<span class="badge ok">Fresh · 14m</span>
<p class="meta">412.6M rows · 86.4 GB · partitioned by order_date (day) · clustered by merchant_id</p>
</header>
<div class="table-wrap"><table class="schema-t">
<thead><tr><th>Column</th><th>Type</th><th>Keys</th><th>Description</th></tr></thead>
<tbody>
<tr><td class="col">order_id</td><td class="type">STRING</td><td class="flags"><span class="key pk">PK</span></td><td class="desc">ord_ prefixed, from checkout-api.</td></tr>
<tr><td class="col">customer_id</td><td class="type">STRING</td><td class="flags"><span class="key fk">FK <a href="#">customers.id</a></span></td><td class="desc"></td></tr>
<tr><td class="col">order_date</td><td class="type">DATE</td><td class="flags"><span class="key part">Partition</span></td><td class="desc">Day the order was placed, IST.</td></tr>
<tr><td class="col">merchant_id</td><td class="type">STRING</td><td class="flags"><span class="key clu">Cluster</span><span class="key fk">FK <a href="#">merchants.id</a></span></td><td class="desc"></td></tr>
<tr><td class="col">amount_minor</td><td class="type">INT64</td><td class="flags"></td><td class="desc">In paise. Divide by 100 for rupees.</td></tr>
<tr><td class="col">currency</td><td class="type">STRING</td><td class="flags"></td><td class="desc">ISO 4217.</td></tr>
<tr><td class="col">customer_email</td><td class="type null">STRING</td><td class="flags"><span class="key pii">PII</span></td><td class="desc">Masked outside the finance role.</td></tr>
<tr><td class="col">items</td><td class="type">ARRAY<STRUCT></td><td class="flags"></td><td class="desc">One entry per line item.</td></tr>
<tr><td class="col nested" style="--d:1">sku</td><td class="type">STRING</td><td class="flags"></td><td class="desc"></td></tr>
<tr><td class="col nested" style="--d:1">qty</td><td class="type">INT64</td><td class="flags"></td><td class="desc"></td></tr>
<tr><td class="col nested" style="--d:1">unit_minor</td><td class="type">INT64</td><td class="flags"></td><td class="desc"></td></tr>
<tr><td class="col">settled_at</td><td class="type null">TIMESTAMP</td><td class="flags"></td><td class="desc">Null until the payment provider settles.</td></tr>
<tr><td class="col">_loaded_at</td><td class="type">TIMESTAMP</td><td class="flags"></td><td class="desc">Set by the loader. Use for incremental models.</td></tr>
</tbody>
</table></div>
<div class="schema-foot"><span>13 columns</span><span>Owner: data-platform</span><span>Updated by dbt · fct_orders.sql</span></div>
</div>A warehouse table the way a data catalogue should show it: the name with its dataset, the numbers that decide how you query it (rows, size, partition and cluster keys), then the columns. Types are mono and quiet, with null after the ones that can be. Nested fields of a struct indent under their parent.
Keys and flags
Code
<span class="key pk">PK</span>
<span class="key fk">FK <a href="#">customers.id</a></span>
<span class="key part">Partition</span>
<span class="key clu">Cluster</span>
<span class="key uq">Unique</span>
<span class="key pii">PII</span>
<span class="key">Deprecated</span>The primary key is amber, because it is what the data at rest is keyed on. Foreign keys are blue and link to their target. Partition and cluster keys share teal: both decide what a query scans, which is what costs money. PII is red, the one flag that changes who may read the column.
| Class | On | What it does |
|---|---|---|
.schema | div | The card: head, table, foot. |
.schema-head | header | A .label for the kind, the name in <b> with the dataset in a muted <span>, a .badge pushed right, then a .meta line under them. |
.schema-t | table | Columns. Cells: .col, .type, .flags, .desc. |
.col.nested | td | A field inside a struct. --d sets the depth. |
.type.null | td | Adds a faint "null" after the type. |
.key | span | Key or flag. .pk, .fk, .part, .clu, .uq, .pii; neutral for anything else. A link inside points to the target. |
.schema-foot | div | Counts, owner, lineage. |
Do
- Rows, size and the partition key in the header. They tell people whether a query will cost a cent or a hundred dollars.
- The unit in the description of every money and time column: paise, IST, UTC.
- Freshness as a badge, from the last load.
Don't
- Hiding nullable. Most bad joins start with a column someone assumed was never null.
- Types in a proportional font.
- Descriptions that repeat the column name.
Accessibility
- It is a real table with headers, so screen readers announce column, type and keys for each row.
- Keys are words in their badges; colour only groups them.