Skip to content

Clauses

This page is generated from the PhiSQL spec artifacts for v1.0. Do not edit it by hand; change the artifact and rebuild.

Clauses modify a verb. The same clause grammar is shared across statements -- for example, WITH and OPTIONS appear on most redaction verbs.

WITH (strategy expression)

Attaches a filter strategy -- and its named arguments -- to a statement. See Strategies for each strategy's arguments.

strategy expr    = strategy name , [ "(" , strategy args , ")" ] ;

strategy name    = "MASK"
                 | "REDACT"
                 | "ENCRYPT"
                 | "FPE_ENCRYPT"
                 | "HASH_SHA256"
                 | "RANDOM_REPLACE"
                 | "STATIC_REPLACE"
                 | "LAST_4"
                 | "TRUNCATE"
                 | "TRUNCATE_TO_YEAR"
                 | "SHIFT"
                 | "RELATIVE"
                 | "ABBREVIATE" ;

strategy args    = named arg , { "," , named arg } ;

named arg        = id , "=" , setting value ;

WHERE (redaction predicate)

Gates a redaction strategy on a condition. In v1.0 the only predicate is CONFIDENCE; see Predicates.

predicate        = confidence predicate
                 | "(" , predicate , ")"
                 | predicate , ( "AND" | "OR" ) , predicate ;

confidence predicate = "CONFIDENCE" , compare op , numeric literal ;

compare op       = ">" | ">=" | "<" | "<=" | "=" ;

WHERE (discovery predicate)

Filters discovered entities by findings-table columns before they reach the findings store. See Findings for the columns.

where discovery  = "WHERE" , discovery predicate ;

discovery predicate
                 = ( column ref , "IN" , string list )
                 | ( column ref , compare op , ( string literal | numeric literal | boolean literal ) )
                 | ( "(" , discovery predicate , ")" )
                 | ( discovery predicate , ( "AND" | "OR" ) , discovery predicate ) ;

OPTIONS

Sets arbitrary leaf properties on the filter a statement compiles to, including nested objects and arrays.

options clause   = "OPTIONS" , "(" , setting list , ")" ;

setting list     = setting , { "," , setting } ;

setting          = setting key , "=" , setting value ;

setting key      = id | string literal ;

setting value    = literal | object value | array value ;

object value     = "(" , setting list , ")" ;

array value      = "[" , [ setting value , { "," , setting value } ] , "]" ;

IN

Names the discovery source URI. See Sources for the recognized URI schemes.

in clause        = "IN" , string literal ;

GROUP BY

Groups SELECT ... FROM findings rows for aggregation.

group by clause  = "GROUP" , "BY" , column ref , { "," , column ref } ;

LIMIT

Caps the number of rows returned by a SELECT.

limit clause     = "LIMIT" , numeric literal ;