SQLly directives

✓ functional

Small SQL comments that remember how you want results shaped, formatted, and charted.

A directive is an ordinary SQL comment that SQLly understands. The database still sees only the query you wrote, while SQLly uses the comment to shape or format its result. Because directives live in the query text, they travel with the file and apply again every time you run it.

Every directive shares the same namespace - the word sqlly after the comment marker:

-- sqlly view: pivot
-- sqlly pivot: row:Region; column:Year; value:Sales:sum
-- sqlly chart: kind:bar; label:Region; values:Sales
-- sqlly format: column=Sales; number=2

Pivot

Turn rows into a cross-tab straight from a comment.

Formatting

Per-column display formatting applied at render time.

Chart

Preconfigure the Chart tab from a comment - type, label, series, and aggregation.

A safety net while you type. If a comment uses the sqlly namespace but is misspelled, placed where it cannot apply, or given an unknown value, SQLly flags it in the editor rather than silently ignoring it.

In this section

  • Pivot — Turn a familiar result set into a cross-tab with a short, portable comment.
  • Formatting — Give each column the presentation it deserves, automatically whenever the query runs.
  • Chart — Tell the Chart tab what story to draw before the result even arrives.