Skip to content

Buildnote Query Language (BNQL)

Buildnote Query Language (BNQL) is a SQL-like query language for querying your data via the Data API.

SELECT

sql
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:

FunctionDescription
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.

sql
SELECT field AS alias            
SELECT aggregateFn(field) AS alias

FROM

Available tables:

TableDescription
modulesBuild modules tracked across your projects
orgsOrganizations in your account
projectsProjects within your organizations
propertiesCustom properties submitted to builds
refsBuild refs tracked across your modules
tagsTags tracked across your builds
testsIndividual test results from build runs

WHERE

Filter rows. Combine conditions with AND and OR.

OperatorDescription
=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.

sql
GROUP BY field1
GROUP BY field1, field2

ORDER BY

Sort results by one or more fields. Direction defaults to ASC.

DirectionDescription
ASCAscending order (smallest to largest)
DESCDescending order (largest to smallest)

FORMAT

Controls output format. Defaults to JSONL.

FormatDescription
CSVComma-separated values
JSONJSON object with results array
JSONLNewline-delimited JSON

Examples

List modules sorted alphabetically:

sql
SELECT org, project, module FROM modules ORDER BY module ASC LIMIT 100

Average duration of failed tests per project, sorted slowest first:

sql
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 CSV

Tables

modules

Build modules tracked across your projects

FieldTypeDescription
orgStringOrganization identifier
projectStringProject identifier
moduleStringModule identifier

orgs

Organizations in your account

FieldTypeDescription
orgStringOrganization identifier

projects

Projects within your organizations

FieldTypeDescription
orgStringOrganization identifier
projectStringProject identifier

properties

Custom properties submitted to builds

FieldTypeDescription
timestampStringEvent timestamp (ISO 8601)
event_idStringEvent ID
entity_idStringEntity identifier (identifies same entities across builds)
orgStringOrganization identifier
projectStringProject identifier
moduleStringModule identifier
buildStringBuild identifier
shaStringGit commit SHA
refStringGit ref (branch or tag)
submitterStringSubmitter identifier
statusStringTest status
tagsStringComma-separated list of tags
durationNumericTest duration in milliseconds
source_typeStringSource tool type (e.g. junit, gradle)
source_urlStringSource URL
collector_idStringCollector identifier
collector_sourceStringCollector source name
nameStringProperty name
valueStringProperty value
typeStringProperty value type

refs

Build refs tracked across your modules

FieldTypeDescription
orgStringOrganization identifier
projectStringProject identifier
moduleStringModule identifier
refStringGit ref (branch or tag)

tags

Tags tracked across your builds

FieldTypeDescription
orgStringOrganization identifier
projectStringProject identifier
moduleStringModule identifier
buildStringBuild identifier
tagStringTag associated with collected event

tests

Individual test results from build runs

FieldTypeDescription
timestampStringEvent timestamp (ISO 8601)
event_idStringEvent ID
entity_idStringEntity identifier (identifies same entities across builds)
orgStringOrganization identifier
projectStringProject identifier
moduleStringModule identifier
buildStringBuild identifier
shaStringGit commit SHA
refStringGit ref (branch or tag)
submitterStringSubmitter identifier
statusStringTest status
tagsStringComma-separated list of tags
durationNumericTest duration in milliseconds
source_typeStringSource tool type (e.g. junit, gradle)
source_urlStringSource URL
collector_idStringCollector identifier
collector_sourceStringCollector source name
typeStringTest category
nameStringTest name
classStringTest class name
suiteStringTest suite name
messageStringTest failure message