Skip to content

docs: add query introspection guide [SPK-392]#586

Draft
charliedowler wants to merge 9 commits intomainfrom
liquid-syntax
Draft

docs: add query introspection guide [SPK-392]#586
charliedowler wants to merge 9 commits intomainfrom
liquid-syntax

Conversation

@charliedowler
Copy link
Copy Markdown
Contributor

Summary

Adds a developer guide covering the new ld.query.fields and ld.query.filters Liquid checks (the "query introspection" feature shipped in PR #21032).

The guide covers:

  • What to check — the two new `contains` checks, with the dotted field-id format and the `lightdash.query` alias
  • Where it works — dimensions, metrics, additional dimensions, custom dimensions; explicit carve-outs for table calculations and rich text
  • The `{% raw %}` requirement — explained with the dbt-Jinja-collision rationale, plus the no-wrapper carve-out for UI-created custom dimensions
  • Three worked examples lined up with Lightdash's actual differentiators:
    1. `smart_revenue` — a metric that defaults to a built-in filter but respects the user's filter when applied (the killer footgun fix)
    2. `active_users` — composes `ld.parameters` and `ld.query.filters` in the same Liquid block (Lightdash's two-system advantage)
    3. A custom dimension built in the UI from the explore — no dbt PR required (something Looker's UI custom fields can't do)
  • More patterns as one-liners (skip expensive ops, drill-aware defaults, self-narrating labels)
  • How to find a field's dotted id, Things to know, and a Related section that cross-links the parameters guide and the references

Changes

  • New page: `guides/developer/query-introspection.mdx`
  • `docs.json` — registers the page right after `using-parameters` in the Developer guides group
  • `guides/developer/using-parameters.mdx` — adds a Related link pointing at the new page

Test plan

  • `mintlify dev` renders the page at `/guides/developer/query-introspection` without errors
  • Sidebar shows the new entry under Developer guides
  • All three YAML format tabs (dbt v1.9 / dbt v1.10 / Lightdash YAML) display correctly for each example
  • Cross-links from `using-parameters` resolve
  • Each example's `{% raw %}` blocks display correctly (not interpreted by Mintlify)

Notes for reviewers

  • Marked draft pending: the screenshot/Loom for the `smart_revenue` demo (worth dropping in near the top, mirroring the Loom embed in `using-parameters.mdx`).
  • Marketing/positioning name ("query introspection" vs "dynamic dimensions and metrics") is unresolved — the docs page uses the developer-facing name; the Headway post can use whatever framing the marketing team picks.

🤖 Generated with Claude Code

Adds a developer guide covering the new ld.query.fields and
ld.query.filters Liquid checks. Covers what to check, where it works,
the {% raw %} requirement for dbt YAML, and three worked examples:

- smart_revenue: a metric that defaults to a built-in filter but
  respects the user's filter when applied
- active_users: composes ld.parameters with ld.query.filters in the
  same Liquid block
- a custom dimension built in the UI from the explore, no PR needed

Wires the page into the Developer guides nav after using-parameters,
and adds a related-link from the parameters page.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 30, 2026

@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Apr 30, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
lightdash 🟢 Ready View Preview Apr 30, 2026, 8:24 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

Table calculations run as SQL in a wrapping SELECT, not client-side, and
Liquid blocks inside them are evaluated by the same render pipeline as
dimensions and metrics. The previous note said neither — claiming they
ran client-side and didn't support introspection. Rewrote it as a
practical "don't reach for this here" caveat instead of an incorrect
technical claim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

- drop the rich-text "does not work in" section: rich-text/markdown
  tiles aren't a SQL pipeline at all, so calling out a "different
  engine (${value.formatted})" was misleading
- clarify joined-table dotted-id: it's the value under `join:`, not
  the `label` — avoids "Order Customer.first_name" guesses
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

Replace the opinionated "rarely useful, stick to dimensions and
metrics" guidance with a factual description of what each check
returns inside a table calculation. Calls out the asymmetry between
fields (largely tautological) and filters (genuinely informative,
since filter context isn't in the result columns).
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

The other "where it works" bullets are one-liners; the table-calc
bullet was a paragraph. Trim it so the list reads consistently.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

Move the explanation into a Note callout so the list stays one-line
per item, but readers still see the asymmetry between
ld.query.fields (largely tautological) and ld.query.filters (useful
because filter context isn't in the result columns).
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

The factual parts of the original wording hold up — `ld.query.fields`
is largely redundant inside a table calculation, and "stick to
dimensions and metrics" is the right default steer for analysts.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

The Liquid + introspection feature was scoped to dimensions and
metrics in the original design. Liquid happening to evaluate inside
table calculations is an incidental side-effect of where the
renderer runs in the query pipeline, not a deliberate feature
surface. Don't advertise it as supported.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

- Drop "anywhere sql: is evaluated" intro that overstated scope
- Note that join `alias:` overrides the model name in dotted ids
- Replace URL-derived field-id tip with a sidebar-hover instruction
- Flag that date dimensions expand into per-interval ids — `event_date`
  won't match a filter on `event_date_day`
- Add the Create Custom Dimension dialog screenshot to the UI example

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

🤖 Documentation Bot

All checks passed! No issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant