Skip to content

keep

keep detects and reports entities in analyzer_results and entity_ledger, but leaves the source text untouched. It is a detect-only operator: it does not redact, mask, encrypt, tokenize, or otherwise change the detected values.

None.

SELECT app_public.mask(
'John Smith emailed jane@acme.com',
OBJECT_CONSTRUCT(
'entity_config', OBJECT_CONSTRUCT(
'PERSON', OBJECT_CONSTRUCT('operator', 'keep'),
'EMAIL_ADDRESS', OBJECT_CONSTRUCT('operator', 'keep')
)
)
);

Output:

{
"columns": [{
"deidentified_text": "John Smith emailed jane@acme.com",
"analyzer_results": [
{"entity_type": "PERSON", "start": 0, "end": 10, "score": 0.97},
{"entity_type": "EMAIL_ADDRESS", "start": 19, "end": 32, "score": 0.99}
]
}],
"entity_ledger": [
{"entity_type": "PERSON", "original": "John Smith", "placeholder": "[REDACTED_PERSON_1]", "replacement": "John Smith"},
{"entity_type": "EMAIL_ADDRESS", "original": "jane@acme.com", "placeholder": "[REDACTED_EMAIL_ADDRESS_1]", "replacement": "jane@acme.com"}
]
}

The deidentified_text equals the input. The ledger catalogs what was detected and can still include the original sensitive values.

  • Sensitive-data scanning: check whether a table contains sensitive values, such as SSNs, without modifying the data.
  • Data discovery: inventory PII or PHI types and locations across a corpus.
  • Audit pipelines: flag records that need review while preserving original content in controlled storage.
  • Pre-masking inspection: run with keep first to review detections, then switch to a redacting or masking operator once the results match your expectations.
  • keep is not de-identification. The original values remain visible in deidentified_text.
  • entity_ledger entries can include original sensitive values. Restrict access to outputs, query results, logs, and downstream storage that receive keep results.
  • Use keep only where raw values are allowed to remain visible. For shared or lower-trust outputs, use a redacting, masking, hashing, synthetic, or encryption operator instead.
  • A keep result should not be treated as redacted output.
  • Detection depends on the configured entities, languages, thresholds, and input quality. A clean keep result is not a guarantee that the source contains no PII or PHI.