Scenario F: Privacy-safe ingestion¶
Part of Streaming Transformations › Scenarios.
Goal¶
Personal data such as email addresses must not land in clear text, and records from users who did not give consent must not land at all.
Transformations used¶
- Custom scalar logic: a SQL UDF replaces personal identifiers with salted hashes in the
SELECTlist. - Stream filtering on stream columns: ingest only records with a consent flag.
- Stream enrichment: attach audience segments.
Source data¶
Stream¶
Each streamed record looks like this:
Dimension table¶
The PIPE joins this dimension table, refreshed periodically:
Target table¶
The PIPE lands redacted and enriched records of consenting users in this target table:
Transformation¶
The PIPE lands records in the target table. Records of users who did not consent are filtered out. Email addresses are replaced with salted hashes, and phone numbers are masked. Audience segments are attached by joining the dimension table.
Result¶
Querying the target table returns rows like these:
| EVENT_TS | CUSTOMER_ID | EMAIL_HASH | PHONE_MASKED | COUNTRY | AUDIENCE_SEGMENT |
|---|---|---|---|---|---|
| 2026-10-09 10:00:00 | c-1001 | 788672793c07c4e4b1e19cb82497fe54ed9832ab0553fa51e10cd93551e3c9c9 | ***-***-4821 | US | frequent_buyer |
| 2026-10-09 10:00:05 | c-1002 | 97adc09b6694caeb9cadcab275c61b0472d722c58b6c4ac5bf56b40fe7b7b24f | ***-***-7713 | DE | new_signup |
The record for c-1003 is dropped because its consent flag is false. The raw email address and phone number never reach the table, and the email is lowercased before salting and hashing, so the same address always produces the same hash regardless of capitalization.
Considerations¶
- Dimension data is a snapshot that refreshes periodically, so updates can take several minutes to appear. This works well for slow-moving reference data. Dynamic tables can be used as dimension tables.
See also¶
See Stream filtering, Stream enrichment, and Custom scalar logic for more information on the transformations used in this scenario.
Previous: Scenario E: Product and clickstream events · Next: Monitoring & Troubleshooting