v1.2.0
  1. ds
  2. Operations
  3. Schema

Schema

Tables, columns, types and keys.

Table analytics.fct_orders Fresh · 14m

412.6M rows · 86.4 GB · partitioned by order_date (day) · clustered by merchant_id

ColumnTypeKeysDescription
order_idSTRINGPKord_ prefixed, from checkout-api.
customer_idSTRINGFK customers.id
order_dateDATEPartitionDay the order was placed, IST.
merchant_idSTRINGClusterFK merchants.id
amount_minorINT64In paise. Divide by 100 for rupees.
currencySTRINGISO 4217.
customer_emailSTRINGPIIMasked outside the finance role.
itemsARRAY<STRUCT>One entry per line item.
skuSTRING
qtyINT64
unit_minorINT64
settled_atTIMESTAMPNull until the payment provider settles.
_loaded_atTIMESTAMPSet 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&lt;STRUCT&gt;</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

PK FK customers.id Partition Cluster Unique PII Deprecated
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.

ClassOnWhat it does
.schemadivThe card: head, table, foot.
.schema-headheaderA .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-ttableColumns. Cells: .col, .type, .flags, .desc.
.col.nestedtdA field inside a struct. --d sets the depth.
.type.nulltdAdds a faint "null" after the type.
.keyspanKey or flag. .pk, .fk, .part, .clu, .uq, .pii; neutral for anything else. A link inside points to the target.
.schema-footdivCounts, 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.