Buildnote Query Language (BNQL)
Buildnote Query Language (BNQL) is a SQL-like query language for querying your data via the Data API.
SELECT
SELECT field1, field2 [AS alias]
FROM <table>
[WHERE condition [AND|OR condition ...]]
[GROUP BY field1, field2, ...]
[ORDER BY field [ASC|DESC] [, ...]]
[LIMIT n]
[FORMAT format]Specify fields to return. Use * to select all fields.
Supported aggregate functions:
| Function | Description |
|---|---|
AVG(field) | Average of all values |
SUM(field) | Sum of all values |
COUNT(field) | Count of all values |
MAX(field) | Maximum value |
MIN(field) | Minimum value |
DISTINCT(field) | Select distinct values |
DISTINCT_COUNT(field) | Count of distinct values |
P001(field) | 0.1th percentile |
P01(field) | 1st percentile |
P05(field) | 5th percentile |
P10(field) | 10th percentile |
P20(field) | 20th percentile |
P25(field) | 25th percentile (Q1) |
P50(field) | 50th percentile (median) |
P75(field) | 75th percentile (Q3) |
P80(field) | 80th percentile |
P90(field) | 90th percentile |
P95(field) | 95th percentile |
P99(field) | 99th percentile |
P999(field) | 99.9th percentile |
AS
Fields and aggregate expressions may be aliased with AS. Aliases may be used in ORDER BY and GROUP BY.
SELECT field AS alias
SELECT aggregateFn(field) AS aliasFROM
Available tables:
| Table | Description |
|---|---|
modules | Build modules tracked across your projects |
orgs | Organizations in your account |
projects | Projects within your organizations |
properties | Custom properties submitted to builds |
refs | Build refs tracked across your modules |
tags | Tags tracked across your builds |
tests | Individual test results from build runs |
WHERE
Filter rows. Combine conditions with AND and OR.
| Operator | Description |
|---|---|
= | Equal |
!= | Not equal |
<> | Not equal (alternative syntax) |
< | Less than |
> | Greater than |
<= | Less than or equal |
>= | Greater than or equal |
GROUP BY
Groups rows for aggregate computation. Required when SELECT contains both aggregate and non-aggregate fields.
GROUP BY field1
GROUP BY field1, field2ORDER BY
Sort results by one or more fields. Direction defaults to ASC.
| Direction | Description |
|---|---|
ASC | Ascending order (smallest to largest) |
DESC | Descending order (largest to smallest) |
FORMAT
Controls output format. Defaults to JSONL.
| Format | Description |
|---|---|
CSV | Comma-separated values |
JSON | JSON object with results array |
JSONL | Newline-delimited JSON |
Examples
List modules sorted alphabetically:
SELECT org, project, module FROM modules ORDER BY module ASC LIMIT 100Average duration of failed tests per project, sorted slowest first:
SELECT org, project, AVG(duration) AS avg_dur FROM tests
WHERE status = 'failed'
GROUP BY org, project
ORDER BY avg_dur DESC
LIMIT 50
FORMAT CSVTables
modules
Build modules tracked across your projects
| Field | Type | Description |
|---|---|---|
org | String | Organization identifier |
project | String | Project identifier |
module | String | Module identifier |
orgs
Organizations in your account
| Field | Type | Description |
|---|---|---|
org | String | Organization identifier |
projects
Projects within your organizations
| Field | Type | Description |
|---|---|---|
org | String | Organization identifier |
project | String | Project identifier |
properties
Custom properties submitted to builds
| Field | Type | Description |
|---|---|---|
timestamp | String | Event timestamp (ISO 8601) |
event_id | String | Event ID |
entity_id | String | Entity identifier (identifies same entities across builds) |
org | String | Organization identifier |
project | String | Project identifier |
module | String | Module identifier |
build | String | Build identifier |
sha | String | Git commit SHA |
ref | String | Git ref (branch or tag) |
submitter | String | Submitter identifier |
status | String | Test status |
tags | String | Comma-separated list of tags |
duration | Numeric | Test duration in milliseconds |
source_type | String | Source tool type (e.g. junit, gradle) |
source_url | String | Source URL |
collector_id | String | Collector identifier |
collector_source | String | Collector source name |
name | String | Property name |
value | String | Property value |
type | String | Property value type |
refs
Build refs tracked across your modules
| Field | Type | Description |
|---|---|---|
org | String | Organization identifier |
project | String | Project identifier |
module | String | Module identifier |
ref | String | Git ref (branch or tag) |
tags
Tags tracked across your builds
| Field | Type | Description |
|---|---|---|
org | String | Organization identifier |
project | String | Project identifier |
module | String | Module identifier |
build | String | Build identifier |
tag | String | Tag associated with collected event |
tests
Individual test results from build runs
| Field | Type | Description |
|---|---|---|
timestamp | String | Event timestamp (ISO 8601) |
event_id | String | Event ID |
entity_id | String | Entity identifier (identifies same entities across builds) |
org | String | Organization identifier |
project | String | Project identifier |
module | String | Module identifier |
build | String | Build identifier |
sha | String | Git commit SHA |
ref | String | Git ref (branch or tag) |
submitter | String | Submitter identifier |
status | String | Test status |
tags | String | Comma-separated list of tags |
duration | Numeric | Test duration in milliseconds |
source_type | String | Source tool type (e.g. junit, gradle) |
source_url | String | Source URL |
collector_id | String | Collector identifier |
collector_source | String | Collector source name |
type | String | Test category |
name | String | Test name |
class | String | Test class name |
suite | String | Test suite name |
message | String | Test failure message |