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.
Parameters
Section titled “Parameters”None.
Example
Section titled “Example”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.
When to use
Section titled “When to use”- 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
keepfirst to review detections, then switch to a redacting or masking operator once the results match your expectations.
Security notes
Section titled “Security notes”keepis not de-identification. The original values remain visible indeidentified_text.entity_ledgerentries can include original sensitive values. Restrict access to outputs, query results, logs, and downstream storage that receivekeepresults.- Use
keeponly where raw values are allowed to remain visible. For shared or lower-trust outputs, use a redacting, masking, hashing, synthetic, or encryption operator instead.
Limitations
Section titled “Limitations”- A
keepresult should not be treated as redacted output. - Detection depends on the configured entities, languages, thresholds, and input quality. A clean
keepresult is not a guarantee that the source contains no PII or PHI.
See also
Section titled “See also”- entity_type — redact with just the type label.
- type_numbered — default, typed+indexed redaction.