maiven gateway · online··
manifest · 1d ago
Sign in
Back to catalog
MAIVENmodelmarts

mart_customers

certified
mart table 1 PII columns

Every customer with their lifetime order rollup.

Definition

One row per customer carrying lifetime order count, lifetime revenue, and first/last order timestamps. The customer-keyed input to `mart_customer_support_health` and to per-customer queries. PII (email) is masked out for AI personas via column grants — row-level access is gated by row policies (e.g. `region_us_analyst` sees only `country='US'`).

Watch out for
  • mediumCounting rows here for "distinct customers"

    This mart is one row per customer, so a naive COUNT over a filtered window double-counts nothing — but a multi-bucket metric query should use `customer_health.customers_count` (uniqExact) instead of summing row counts.

  • mediumReading `email` from an AI persona

    `email` is PII and excluded from `bi_reader` / `ai_readonly` via column grants. A query that selects it as those personas returns a permission error, not a null.

Questions this answers
  • “How many customers are in each segment?”
  • “Who are the highest lifetime-revenue customers in the US?”
9 of 9
Column
Type
Description
Tests · PII
customer_id
UInt64
Primary key — UInt64. Matches `stg_postgres__customers.customer_id`.
email
String
Customer email. PII — hidden from AI personas via column-level grants.
PII
country
Nullable(String)
ISO-2 country code (upper-cased upstream). Drives the `region_us_analyst` row policy.
segment
Nullable(String)
Customer segment — `consumer`, `business`, or `enterprise`.
signup_date
Date
Date the customer first registered.
orders_count
UInt64
Lifetime count of revenue-eligible orders (excludes `cancelled` / `refunded`). Zero for customers with no orders.
lifetime_revenue
Decimal(14, 2)
Sum of `total_amount` across revenue-eligible orders. Decimal(14,2); zero for customers with no qualifying orders.
2 tests
first_order_at
DateTime64(6)
Timestamp of the customer's first revenue-eligible order. Null for customers with none.
last_order_at
DateTime64(6)
Timestamp of the customer's most recent revenue-eligible order. Null for customers with none.