current_values

current_fields with value unwrapped from JSON

What you'll learn

You're writing SQL that reads current_values and need its columns, what each holds, and the DDL as the spec states it.

  • every column and its type
  • what the object holds and who writes it
  • the DDL as the spec states it

A view. current_fields with value unwrapped from JSON — the view to query for plain values.

Columns

identity_id, field, value, source, confidence, run_id, created_at.

Definition

From spec/ledger.sql, which is the machine-checkable form of SPEC.md §3:

-- Vocabulary views (ADR-037): the read surface user-authored SQL (§10a) and
-- config queries (§9) are written against, so a query reads as vocabulary
-- rather than as table internals. current_values is current_fields with the
-- JSON encoding unwrapped; group_membership is group_members keyed by name.
CREATE VIEW current_values AS
SELECT identity_id, field, json_extract(value, '$') AS value, source, confidence, run_id, created_at
FROM current_fields;

Used in

  • Segment: The view a slice reads each person's latest values from