Availability: Pre-aggregates are an Early Access feature available on Enterprise plans only.
lightdash pre-aggregate-audit reports, for one dashboard or every dashboard in a project, which tiles are served from a pre-aggregate, which ones miss (and why), and which ones are ineligible for pre-aggregates entirely. It calls the same audit data as the in-app Pre-aggregation audit menu (see Dashboard pre-aggregate view) but exposes it for scripting, automation, and CI.
When to use it
The CLI audit is the right tool when you want to:- Iterate on pre-aggregate YAML and verify that misses you’ve targeted are now hits, without clicking through dashboards in the UI
- Run a project-wide sweep to find dashboards that aren’t benefitting from pre-aggregates yet
- Get machine-readable JSON for custom reporting (for example, exporting coverage to a BI tool or Slack)
- Block merges in CI when a critical dashboard regresses to warehouse queries
Prerequisites
- Lightdash Enterprise plan
- Install the Lightdash CLI
- Authenticate with
lightdash login
Auditing a single dashboard
Pass the dashboard’s UUID or its URL slug:- Hit — the chart is served from the named pre-aggregate
- Miss — the chart is eligible to use pre-aggregates but no pre-aggregate matches. The output prints the miss reason
- Ineligible — the tile cannot use pre-aggregates at all (markdown tile, SQL chart, orphaned chart, broken explore). Hidden by default; pass
--verboseto expand
Auditing every dashboard
Selecting the project
The CLI resolves the project in this order:--project <uuid>flagLIGHTDASH_PROJECT_UUIDenvironment variable- The project saved by your last
lightdash login/lightdash config set-project
JSON output for scripting
{ "dashboards": [...] } when combined with --all). Pipe into jq to extract what you care about — for example, every dashboard with at least one miss:
Using audit results to improve your YAML
The miss labels printed by the CLI are the same ones documented in Why a query misses a pre-aggregate — that table maps each reason to the YAML or configuration change that fixes it. A typical iteration loop:lightdash pre-aggregate-audit --dashboard <slug>to see the current misses- Edit your dbt model YAML to address each miss (use the miss-reason table to know which field to change)
lightdash deployto push the change- Trigger a refresh from Project Settings > Pre-aggregates if the pre-aggregate definition changed
- Re-run the audit to confirm the misses are now hits
CI integration with --fail-on-miss
--fail-on-miss makes the command exit with code 1 if any tile is a miss, so CI can block changes that regress pre-aggregate coverage:
Flag reference
| Flag | Description |
|---|---|
--dashboard <uuid-or-slug> | Audit a specific dashboard. Required unless --all is set. |
--all | Audit every dashboard in the project. |
--project <uuid> | Override the active project. Falls back to LIGHTDASH_PROJECT_UUID, then to the CLI config. |
--json | Emit machine-readable JSON instead of the human-friendly text output. |
--fail-on-miss | Exit 1 if any eligible tile misses. Ineligible tiles do not trigger a failure. |
--verbose | Include ineligible tiles (and their reason) in the human output. |