Skip to content

Add SQL template variables to warehouse metric and exposure docs#37995

Open
htrajan wants to merge 2 commits into
masterfrom
htrajan/EX-3029
Open

Add SQL template variables to warehouse metric and exposure docs#37995
htrajan wants to merge 2 commits into
masterfrom
htrajan/EX-3029

Conversation

@htrajan

@htrajan htrajan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Documents the {{variable}} SQL template variables that Datadog Experiments customers can use in Metric SQL Models and Exposure SQL Models for warehouse-native experiments. Template variables let customers push Datadog's date filters into their own SQL so each pipeline run scans only the data it needs.

Adds a "Filter with template variables" section to two existing articles:

  • content/en/experiments/defining_metrics.md (Warehouse tab, Metric SQL Model)
  • content/en/experiments/concepts/exposure_sql.md (Exposure SQL Model)

Each section includes a reference table of the supported variables, the ISO 8601 / quoting rules, and a worked SQL example:

  • {{analysis_start_timestamp}} / {{analysis_end_timestamp}} — the window the current update materializes (full window on a full refresh; the current tranche on an incremental refresh)
  • {{experiment_events_start_timestamp}} / {{experiment_events_end_timestamp}} — the full experiment event window, even during incremental refreshes
  • {{assignments_start_timestamp}} / {{assignments_end_timestamp}} — the assignment window
  • {{experiment_key}}, {{experiment_keys}}, {{allocation_key}} — flag-allocation keys, rendered as quoted string literals

Motivation

Customers with large warehouse tables need a documented way to limit what the experiment pipeline scans on each run. These variables already exist in the product but were undocumented.

Review notes

  • Content-only change to two existing articles (+55 lines); no menu or structural changes.
  • Uses plain {{var}} syntax, consistent with how existing docs (for example, monitors/types/slo.md) render literal template variables.

Made with Cursor

Document the {{variable}} template variables customers can use in Metric
SQL Models and Exposure SQL Models to push Datadog's date filters into
their own SQL and reduce the data scanned on each pipeline run. Covers
the analysis, experiment-events, and assignment window timestamps plus
the experiment/allocation key variables, and notes that timestamps
render as ISO 8601 strings (quote them) while key variables are already
quoted.

Co-authored-by: Cursor <cursoragent@cursor.com>
@htrajan htrajan requested a review from a team as a code owner July 6, 2026 21:56
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@lukasgoetzweiss

Copy link
Copy Markdown
Contributor

@htrajan I worry that this current placement takes a lot of real estate for people first learning about warehouse native architecture. This is a bit of an advanced feature, so I wonder if we can break it out into a separate page under "concepts" and link there from the exposure and metric SQL models page. That also reduces the need to duplicate the list of variables on multiple pages

Thoughts?

Keep introductory warehouse documentation concise while preserving the complete variable reference and examples in one discoverable location.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the Architecture Everything related to the Doc backend label Jul 14, 2026
@htrajan

htrajan commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

I wonder if we can break it out into a separate page under "concepts" and link there from the exposure and metric SQL models page. That also reduces the need to duplicate the list of variables on multiple pages

@lukasgoetzweiss Agreed—I've implemented this. The full SQL template variable reference now lives on a new Concepts page, both the Metric and Exposure SQL Model pages link to it, and the approved variable descriptions and examples are preserved on the consolidated page.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/documentation | build_preview   View in Datadog   GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6f3f3e3 | Docs | Datadog PR Page | Give us feedback!

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

Labels

Architecture Everything related to the Doc backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants