SQL Editor Examples
Examples of SQL queries you can write with the Laminar SQL Editor
This page contains a collection of examples of SQL queries you can write with the Laminar SQL Editor. For the reference of the table schemas and Laminar-specific syntax, see the reference page.
Basic queries
Counting spans in the last 3 days
Counting spans by name
Viewing spans of a specific evaluation run
This query will return the input and output of the spans of the evaluation run with the name the-evaluation-name
.
It is useful to filter by span type in this query to filter either the executor (forward pass) or the evaluator spans.
Filtering spans by type
Available span types:
DEFAULT
- most of the spans fall into this categoryLLM
- a manual or automatically traced LLM callEVALUATION
- a span that represents an evaluation run. One datapoint is evaluated by one evaluation run.EXECUTOR
- a span that represents an executor run. One datapoint is evaluated by one executor run.EVALUATOR
- a span that represents an evaluator run. One datapoint may have multiple evaluator spans.TOOL
- a span that represents a tool call.
Filtering spans by span path
Span path is the hierarchical path of the span.
For example, if your code looks like this:
Then the span path of the inner
function will be ["outer", "inner"]
.
Span path is stored as a JSONB array inside the attributes
column’s values.
However, Laminar SQL provides syntactic sugar for you to query, filter, order, or group by span path items joined by a dot.