Telemetry
Reproducible SQL cookbook

How every Telemetry SQL recipe is tested

The cookbook separates machine-checkable SQL compatibility from human-reviewable interpretation. That boundary makes each example useful without pretending synthetic data can validate your business rules.

Current test target

Apache DataFusion 45.2.0

43

queries in the suite

0

write statements allowed

Automated quality gate

Four checks before a recipe is published

1

Complete recipe contract

The audit requires a question, event schema, SQL, sample result, visualization, explanation, edge cases, dashboard guidance, alert guidance, and related reading.

2

Read-only statement policy

Queries must start with SELECT or WITH. The audit rejects DDL and write keywords such as CREATE, INSERT, UPDATE, DELETE, DROP, ALTER, and MERGE.

3

Typed DataFusion execution

Each schema becomes an empty Apache Arrow record batch. The query is planned and executed with Apache DataFusion 45.2.0, catching invalid columns, types, functions, and syntax.

4

Rendered-page integrity

The site audit renders every recipe and checks its status, canonical URL, title, description, H1, structured data, and internal links.

What the execution check proves

The audit constructs every documented table from the field names and Arrow types shown on the recipe page. It registers an empty batch in a fresh DataFusion session, runs the exact published SQL, and fails if the engine rejects the plan or execution. This catches misspelled fields, incompatible operations, unsupported functions, ambiguous columns, malformed intervals, and many return-type mistakes without requiring production data.

The pinned version is intentional. SQL engines evolve, so a query is not labeled compatible merely because a similar dialect accepts it. When the application upgrades DataFusion, the full collection is rerun before the documented version changes.

Safe to copy is not safe to assume

The query cannot know your definition of an active account, recovered payment, permanent webhook failure, or acceptable latency. Each recipe names those choices so reviewers can change them before a dashboard or alert becomes authoritative.

Human review

What still needs judgment

An empty typed table proves that a query plans and executes; it does not prove that a business definition is correct.

Displayed rows and charts are deterministic synthetic examples. They show the output shape and intended interpretation, not a benchmark or customer result.

Thresholds, minimum volumes, time windows, identity rules, currencies, and terminal statuses must be adapted to the event contract that owns them.

Late events, duplicated provider deliveries, incomplete newest buckets, and schema changes can alter real results even when the SQL is valid.

Validate a recipe on your own event contract

Match field names and types, send a small synthetic fixture that covers success and failure paths, inspect intermediate CTEs, compare totals to known inputs, and document the final business definition beside the saved query.