Skip to content
Foxx Cyberfoxxcyber/docs

The query language (BQL)

How to ask Discover a question: the shape of a query, filters, dates, grouping, measures, and every thing you can ask about, with examples.

Discover answers questions about what you can see. You write a short query, or build it in the Builder, which writes the same text. Nobody writes SQL. A query only ever sees what you may see, so a query shared with you gives you the answer for your own access.

For the screen itself see Discover and Reports.

A first query

packages where categorization = MODERATE and authorization in (ATO, "ATO with conditions") count

How many Moderate packages hold an ATO, with or without conditions.

The shape of a query

A query says what to look at, then, in this order and each part optional:

what  where <filter>  group by <field>  <measure>  sort by <key>  limit <n>
  • What is one of the things in the table below, for example packages or obligations.
  • where filters. Join tests with and and or (and binds first; use parentheses to change that), and use not to turn a test around.
  • group by splits the answer into groups. Use at most two fields.
  • A measure counts or adds: count, sum(field), avg(field), min(field), max(field).
  • sort by orders the answer. limit caps the rows (1,000 unless you say otherwise, at most 5,000).

What you get depends on what you wrote:

You wroteYou get
Just the thing, maybe with whereA list of rows with the default columns.
A measure, no group byOne row: a number.
group by and a measureOne row per group.

Tests in where

TestExample
Compare: = != < <= > >=days_left < 90
In a list: in (a, b) or not inauthorization in (ATO, IATT)
Is empty: is empty, is not emptypoam_number is empty
Contains texttitle contains "credentials"
  • Words and enum values are case-insensitive. A value with spaces goes in quotes.
  • An enum accepts its key or its label: ato_conditions and "ATO with conditions" are the same.
  • A field with no value is never equal to anything, and is always !=.

Dates

Compare a date field with a date (2026-12-31), today, or a time from today: 30d (days), 12w (weeks), 6m (months), 1y (years). A minus means the past: -30d.

  • expires < 90d means before the day that is 90 days from now.
  • decision_date > -1y means within the last year.

Grouping and measures

  • packages group by program_office count is packages per program office.
  • packages group by area, standing count is standing per area, for a stacked bar.
  • Name a measure to sort by it: count, sum_cat1_open, avg_days_left, min_expires (the function, an underscore, and the field with dots turned into underscores).
  • A grouped answer with no sort by is ordered by its first measure, largest first. A date group is ordered by date.

What the answer looks like

Discover picks a chart for the shape of the answer: a number for a measure, a bar for one group, a stacked bar for two, a timeline for a date group, and a table for a list. You can switch among those that make sense.

What you can ask about

Every field has a short description in the Fields panel in Discover.

Ask aboutWhat it holds
packagesATO packages with their standing, posture and authorization. Fields include categorization, authorization, expires, days_left, standing, failing_checks, cat1_open, obligations_overdue, sca_team, source, recommendation.
obligationsOpen ConMon, condition, guidance, CTO and finding obligations: kind, state, due_on, days_until_due.
findingsAssessment findings: severity, status, control, cci, poam_number, days_open.
exceptionsException requests: status, check_title, expires_on, recommendation.
decisionsAuthorization decisions: decision, status, decision_date, termination_date, residual_risk.
transfersPackages moving between program offices.
guidanceGuidance and CTOs: kind, status, effective_on, requires_acknowledgment.
assessment_plansSCA plans: status, start_on, end_on.
assessment_reportsReports and the SCA's recommendation: recommendation, residual_risk.
controlsEach control of each native package: implementation_status, responsibility, family.
poams and milestonesNative POA&Ms and their milestones: severity, status, scheduled_completion.
artifactsFiles kept with packages: kind, versions, latest_uploaded.
scansImported scan files: kind, scanned_at, hosts, cat1.
iavmThe IAVMs each package's scans reference: iav_id, status, comply_by, hosts.
iavm_noticesThe notices of the bulletin in force: iav_id, type, title, comply_by.
stig_coverageThe STIGs that apply to each asset: asset, benchmark, coverage, last_scan_at.
hardwareThe hardware inventory: name, asset_type, os_name, ip_addresses.
softwareThe software inventory: name, version, end_of_support, days_to_end_of_support, installs.
portsPorts, protocols and services: port_start, protocol, boundary, ppsm_status.
interconnectionsConnections to other systems: connection_type, agreement, agreement_expires.

Anything about a package is available from the other things with a package. prefix, for example package.program_office or package.standing.

A dot reaches a related thing or a section: package.program_office, standing.compliance.

Examples

packages where standing = fail count
packages group by program_office count sort by count desc
packages group by area, standing count
packages where expires < 90d and expires >= today sort by expires
packages where cat1_open > 0 sum(cat1_open)
packages where authorization = ato avg(days_left), min(expires)
packages where transferred = true count
obligations where state = overdue group by package.program_office count
exceptions where status = approved and days_left < 30
decisions where status = draft
assessment_plans where status = submitted
guidance where kind = cto
iavm where status = overdue group by package count
software where days_to_end_of_support < 90 sort by days_to_end_of_support
ports where ppsm_status = unknown and boundary = external
stig_coverage where coverage = missing group by package count

Limits and errors

  • A query is at most 4,000 characters, 16 levels deep, and runs for at most 2 seconds. If it takes longer you are told to narrow it. You can run 30 in 10 seconds.
  • A result holds up to 500 groups. A note says when more existed.
  • A query that does not parse is refused with the line and column, a message in plain words and the choices that would have been valid. For example: Unknown field 'categorisation' on packages. Did you mean 'categorization'?

Saved queries and exports

A saved query is the text plus how to show it. It is private to you, or shared with a unit so everyone at or below that unit can run it, always as themselves. Only the owner changes or deletes it. Export CSV downloads a result. Text cells that start with =, +, - or @ are prefixed with a quote so a spreadsheet does not run them as a formula.

Last updated November 17, 2026