SELECT NORMALIZE_PHONE('NATIONAL', '+15145555555', null) AS normalizedSELECT NORMALIZE_PHONE('E164', phone, 'US') AS e164_phone FROM company_data."123"
Encodes a clear text identifier into a Narrative ID within a specific encoding space. Narrative IDs are per-partner pseudonymous identifiers that enable privacy-safe data collaboration.Syntax:
NARRATIVE_ID_ENCODE(raw_identifier, key_id)
Parameters:
Parameter
Type
Description
raw_identifier
string
The clear text identifier to encode (email, hashed email, phone, etc.)
key_id
string
The encoding key ID specifying the target encoding space
Returns: string - The encoded Narrative IDExamples:
-- Encode an email addressSELECT NARRATIVE_ID_ENCODE(LOWER(TRIM(email)), 'your_org_key_id') AS narrative_idFROM company_data."123"-- Encode an already-hashed emailSELECT NARRATIVE_ID_ENCODE(email_sha256, 'your_org_key_id') AS narrative_idFROM company_data."123"-- Create a dataset with encoded identifiersSELECT NARRATIVE_ID_ENCODE(email_sha256, 'your_org_key_id') AS narrative_id, event_timestamp, event_propertiesFROM company_data."123"WHERE event_timestamp >= '2024-01-01'
The same identifier encoded with different key_id values produces different Narrative IDs. Always normalize identifiers (lowercase, trim whitespace) before encoding for consistent matching.
Translates a Narrative ID from one partner’s encoding space to another. This enables secure data collaboration by converting identifiers without exposing the underlying clear text values.Syntax:
The encoding key ID for the target partner’s encoding space
Returns: string - The translated Narrative ID in the target encoding spaceExamples:
-- Translate Narrative IDs for a partner collaborationSELECT NARRATIVE_ID_TRANSLATE(narrative_id, 'partner_b_key_id') AS partner_b_narrative_id, customer_segment, activity_scoreFROM company_data."123"-- Join across partner datasets using translationSELECT a.campaign_name, a.impressions, b.conversionsFROM partner_a."ad_data" aJOIN partner_b."conversion_data" b ON NARRATIVE_ID_TRANSLATE(a.narrative_id, 'partner_b_key_id') = b.narrative_id-- Prepare data for multiple partnersSELECT narrative_id AS original_id, NARRATIVE_ID_TRANSLATE(narrative_id, 'partner_a_key_id') AS partner_a_id, NARRATIVE_ID_TRANSLATE(narrative_id, 'partner_b_key_id') AS partner_b_id, audience_segmentFROM company_data."123"
Use case:When sharing data with a partner, translate your Narrative IDs to their encoding space so they can match against their own Narrative IDs. This enables cross-organization matching without exposing underlying identifiers.Related:Narrative ID Concepts, Using Narrative ID
Returns a struct with null-valued fields removed. On AWS hosted data planes, the function is accepted for cross-platform query compatibility but operates as a no-op.