Notion model

Status breakdown

How many pages sit in each status of each database, and how stale they are. The board view of a Notion database, as a table. A snapshot as of the last sync.

Grain
data source x status property x status value
Built from
  1. 4
    Raw tables
  2. 4
    Staging
  3. 2
    Core
  4. 1
    Analytics
Reads from Notion
data_sourcepagepage_propertyuser
Ships as
Weld and dbt SQL, open source on GitHub
core.notion.status_breakdown
1-- core.notion.status_breakdown
2-- How many pages sit in each status of each database, and how stale they are.
3-- The board view of a Notion database, as a table. A snapshot as of the last sync.
4-- Grain: data source x status property x status value.
5--
6-- Archived and trashed pages are excluded. Pages with an empty status show as
7-- status NULL. Staleness uses last_edited_at, which moves on any edit to the page,
8-- not only status changes: Notion does not expose when a status was set.
9
10SELECT
11    data_source_id,
12    data_source_title,
13    status_property,
14    status,
15    COUNT(*)                                                    AS pages,
16    COUNTIF(days_since_last_edit > 30)                          AS pages_not_edited_30d,
17    MIN(created_at)                                             AS oldest_created_at,
18    MAX(last_edited_at)                                         AS latest_edit_at,
19    APPROX_QUANTILES(days_since_last_edit, 2)[OFFSET(1)]        AS median_days_since_last_edit
20FROM {{core.notion.database_pages}}
21WHERE NOT is_archived
22  AND status_property IS NOT NULL
23GROUP BY 1, 2, 3, 4

This model and the 6 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

Archived and trashed pages are excluded. Pages with an empty status show as status NULL. Staleness uses last_edited_at, which moves on any edit to the page, not only status changes: Notion does not expose when a status was set.

Raw tables it reads

  • raw.notion.data_source
  • raw.notion.page
  • raw.notion.page_property
  • raw.notion.user

Put Notion in front
of your agents.

Connect Notion, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.