Skip to main content
Goal: write a typed, parameterized query surface using the deployment’s own authoring skill as the grammar reference — not guesswork.

3.1 · Pull the authoritative grammar

The deployment ships the same instruction sets the product’s agent uses. Discover and fetch them — don’t guess trigger names:
Prompt
You’ll see: the complete .tql language reference — file layout, the params grammar, fragment functions, and a “rejected forms” table of the mistakes everyone makes. Keep it open while authoring.

3.2 · The guardrails that save you an hour

You’ll tryThe language wants
metrics: Set<"a"|"b"> = ["a"]Set defaults may only be [] — handle the empty case in the body with isEmpty
concatSep(", ", frags)Application syntax, no parens/commas: concatSep ", " frags
matchSet as a functionIt’s syntax: matchSet metrics { "label" -> sql"...", } (arrow arms; trailing comma allowed here only)
'${param}' in SQLUnquoted ${param} — the renderer handles quoting; IN ${list} adds parens
'' inside a sql''…'' bodyNo adjacent single quotes there — put quoted SQL literals in sql"…" fragments

3.3 · The authoring loop

  • Write the file (params block → let bindings → one sql''…'' body ending in an explicit LIMIT).
  • Execute it against a live connector with real parameters. Not “it parses” — it returns correct rows.
  • Reconcile one number against a raw-SQL computation of the same thing before you call it done.
⚠️ Execute before you save — a true story — A flows query surface joined a snapshot table (several rows per entity) to a fact table. It parsed, rendered, and ran — and inflated every total ~6.5×. The only reason no user ever saw the wrong number: the surface was executed against the live connector and reconciled before installation, the join deduplicated, re-verified to the dollar. An untested query surface is a liability wearing a governance costume.

✅ Checkpoint

  • You fetched writing-tql from your own deployment and used its rejected-forms table
  • Your .tql executed against a live connector with parameters
  • One output number reconciled against an independent raw-SQL computation