Skip to Content
IdentityWarehouse Tables and SQL

Warehouse Tables and SQL

A graph with a realtime half writes what realtime identity knows into the graph’s output schema in your warehouse (cdp_identity unless you chose another), beside the tables your warehouse resolution already writes. This page describes those tables and the SQL to use them.

Your events carry the profile ID they had when they arrived; the ID map turns any retired profile ID into the one it became; the identifiers table gives today's person

The tables

TableOne row perColumns
_IDENTITY_IDENTIFIERSidentifier valuefamily, value_key, ss_id (the profile ID), ownership, owner_reason, match_type, min_confidence, first_seen, last_seen
_IDENTITY_ID_MAPretired profile IDprofile_id, current_profile_id, changed_at, kind
_IDENTITY_SSID_MOVESprofile ID that moved on the last runold_ss_id, new_ss_id, kind, run_id, moved_at
rt_obs_<graph>pair of identifiers realtime linked, per dayworkspace_id, graph_id, profile_id, the identifiers, trust, first_ms, received_at
rt_chg_<graph>change to a profileevery merge, split and correction, with its reason and time
  • ownership says how an identifier belongs to its profile: owned (only this person carries it), attributed (several people carry it and shared identifier attribution chose this one), shared (it links no one: several people carry it, or, with owner_reason surplus, it is beyond its person’s per-profile limit) or nonlinking (its family forms no links, for example one matched only probabilistically). A value on your blocked-values list has no row.
  • first_seen and last_seen are the earliest and latest timestamps of the model rows carrying the value, from each model’s timestamp column. first_seen never moves later. A value only carried by models with no timestamp column takes the time of the run that first saw it, and last_seen is the latest run.
  • value_key holds emails, phone numbers and other personal identifiers as their SHA-256 hashes, normalised exactly as the SDKs and the identity API do.
  • ss_id is the profile ID realtime identity uses for the same person (see Realtime and Warehouse Identity).

Today’s person for a historical event

When the Identity enrichment adds the profile ID to your events, each event in your warehouse keeps the profile ID it had when it arrived. One join turns it into today’s:

BigQuery
SELECT e.*, COALESCE(m.current_profile_id, JSON_VALUE(e.enrichment, '$.identity.profile_id')) AS person_id FROM events e LEFT JOIN cdp_identity._IDENTITY_ID_MAP m ON m.profile_id = JSON_VALUE(e.enrichment, '$.identity.profile_id')
Snowflake
SELECT e.*, COALESCE(m.current_profile_id, e.enrichment:identity:profile_id::string) AS person_id FROM events e LEFT JOIN cdp_identity._IDENTITY_ID_MAP m ON m.profile_id = e.enrichment:identity:profile_id::string
Databricks
SELECT e.*, COALESCE(m.current_profile_id, get_json_object(e.enrichment, '$.identity.profile_id')) AS person_id FROM events e LEFT JOIN cdp_identity._IDENTITY_ID_MAP m ON m.profile_id = get_json_object(e.enrichment, '$.identity.profile_id')
ClickHouse
SELECT e.*, if(m.current_profile_id != '', m.current_profile_id, JSONExtractString(e.enrichment, 'identity', 'profile_id')) AS person_id FROM events AS e LEFT JOIN cdp_identity._IDENTITY_ID_MAP AS m ON m.profile_id = JSONExtractString(e.enrichment, 'identity', 'profile_id')
Redshift
SELECT e.*, COALESCE(m.current_profile_id, JSON_EXTRACT_PATH_TEXT(e.enrichment, 'identity', 'profile_id')) AS person_id FROM events e LEFT JOIN cdp_identity._IDENTITY_ID_MAP m ON m.profile_id = JSON_EXTRACT_PATH_TEXT(e.enrichment, 'identity', 'profile_id')

The ID map is complete for merges: a merged-away ID always maps to the ID it became, however many merges followed, and an ID that was never merged has no row, which is why the join keeps the event’s own ID.

After a split

A split gives the part that left a new profile ID, while the ID map keeps the original ID for the part that stayed. To place each historical event with the person who holds its identifier today, join the event’s identifier to _IDENTITY_IDENTIFIERS instead:

Any warehouse
SELECT e.*, i.ss_id AS person_id FROM events e JOIN cdp_identity._IDENTITY_IDENTIFIERS i ON i.family = 'user_id' AND i.value_key = e.user_id

For a hashed family, join on the hash of the normalised value: for example i.family = 'email' and i.value_key = TO_HEX(SHA256(LOWER(TRIM(e.email)))) on BigQuery.

Profiles that moved on a run

_IDENTITY_SSID_MOVES lists every profile ID that changed on the last warehouse run (merge, split, rename or mixed), so a downstream job can update what it stored without comparing whole tables.

These tables are refreshed on every warehouse run of the graph. A graph with only a warehouse half does not write them.

Last updated on