Skip to content

Lists

Use in to check if a value is in a list, and not in to check it is not:

status in [200, 201, 204]
env not in ['prod', 'staging']
  • Values are enclosed in square brackets [ ] and separated by commas
  • All values in a list must be the same type (all strings or all numbers)
  • String values must be quoted: ['a', 'b', 'c']
  • Numeric values are unquoted: [1, 2, 3]
  • Spaces around commas and brackets are allowed
method in ['GET', 'POST', 'PUT']
env not in ['dev', 'test', 'local']

Both single and double quotes work for string values.

status in [200, 201, 204]
port not in [80, 443]

Empty lists are allowed:

status in [] # always false — nothing matches an empty list
status not in [] # always true — everything is "not in" an empty list

Lists must contain values of a uniform type — all strings or all numbers. Mixing types within a single list causes a parse error:

# Valid — all numbers
status in [200, 201, 204]
# Valid — all strings
env in ['prod', 'staging']
# Invalid — mixed types (parse error)
values in [200, 'ok']

The parser tracks the type of the first value in the list and rejects any subsequent value of a different type. This is enforced at parse time, before the query reaches any generator or matcher.

When a SQL generator processes a list, it additionally validates that the list value types are compatible with the target column type. For example, passing string values to a numeric column will raise a validation error during SQL generation.

The valuesType field on the parsed expression indicates whether the list contains "string" or "number" values. For empty lists, valuesType is null.

List operators combine with boolean operators like any other condition:

status in [200, 201] and method in ['GET', 'POST']
level=error or status not in [200, 201, 204]
(status in [500, 502, 503] or level=critical) and env=prod
# HTTP success codes
status in [200, 201, 204]
# Exclude test environments
env not in ['dev', 'test', 'staging']
# Multiple list conditions
method in ['GET', 'POST'] and status not in [401, 403, 404]