Sources Metadata

Per-source ingestion metadata and freshness — pipeline, the field mapped to _ingested_at, and MAX(_ingested_at) from nexus_events

The nexus_sources_metadata table provides one row per configured source, combining declarative ingestion config (how the source is loaded) with warehouse freshness (how recently it was loaded). It's the canonical place to answer "when did each source last get data, and how does it get here?".

Overview

Each row joins two things the warehouse alone can't give you together:

  • Config side — from the optional ingestion: block on each source in var('nexus').sources: the pipeline (connector), the ingested_at_field (the raw column mapped to _ingested_at), and the source's enabled/events/dimensions/measurements/entities/attribution flags.
  • Warehouse sideMAX(_ingested_at), MIN/MAX(occurred_at) and event count per source, grouped from nexus_events.

A FULL OUTER JOIN surfaces both configured-but-empty sources (is_in_data = false) and sources present in the event log that aren't configured here (is_configured = false).

Freshness semantics

last_ingested_at is MAX(_ingested_at) — the real warehouse load time for the source's ingested_at_field (Airbyte's _airbyte_extracted_at, an ETL's etl_load_dt, etc.). Because MAX ignores NULLs, sources that populate their load column only sparsely still report their true latest load.

When a source has no warehouse load column at all (e.g. a GA4 export that only carries event timestamps), its _ingested_at is NULL and last_ingested_at is NULL — a genuine "unknown", never a fabricated build-time value. Consumers should treat NULL as unknown and may fall back to last_event_at (the latest occurred_at) as a data-recency proxy.

Schema

Field Type Description
source String Canonical source identity (the source value in nexus_events)
config_key String The key under var('nexus').sources (may differ from source)
pipeline String Ingestion connector/pipeline, e.g. airbyte, cinch_etl, custom
ingested_at_field String Raw column mapped to _ingested_at (e.g. _airbyte_extracted_at); NULL if none
enabled Boolean Source enabled in config
has_events Boolean Source contributes events
has_dimensions Boolean Source contributes event dimensions
has_measurements Boolean Source contributes event measurements
has_entities Boolean Source contributes entities
has_attribution Boolean Source participates in attribution
last_ingested_at Timestamp MAX(_ingested_at) — real load time, or NULL if unknown
first_event_at Timestamp MIN(occurred_at)
last_event_at Timestamp MAX(occurred_at) — data-recency proxy when load time is unknown
event_count Integer Number of events from this source in nexus_events
is_in_data Boolean Source has rows in nexus_events
is_configured Boolean Source is declared in var('nexus').sources

Configuring ingestion metadata

pipeline, ingested_at_field, and an optional source_label come from an ingestion: block per source. All keys are optional and backward-compatible — omit them and the columns are NULL.

vars:
  nexus:
    sources:
      google_ads:
        events: true
        ingestion:
          pipeline: airbyte
          ingested_at_field: _airbyte_extracted_at
          # Optional: the nexus_events.source literal to join on, when a
          # source's emitted `source` value differs from its config key.
          # Defaults to the config key.
          source_label: google_ads

Query Examples

Source freshness, stalest first

select
    source,
    pipeline,
    ingested_at_field,
    last_ingested_at,
    event_count
from {{ ref('nexus_sources_metadata') }}
order by last_ingested_at asc nulls first

Sources with an unknown ingestion time

select source, pipeline, last_event_at
from {{ ref('nexus_sources_metadata') }}
where last_ingested_at is null
  and is_in_data